NAME

Haver::Wheel - Base class for modules that extend POE::Session at runtime.

SYNOPSIS

package MyPlugin;
use POE;
use base 'Haver::Wheel';

sub setup {
	my $self = shift;
	$self->provide('foo', 'on_foo');
}

sub on_foo {
	my ($kernel, $heap, $self) = @_[KERNEL, HEAP, OBJECT];
	# ...
}

DESCRIPTION

This module allows the loading and unloading of object states into a running POE::Session.

Plugins are not unlike a POE::Wheel, except instead of producing events, they respond to them.

This behavior is similar to that of POE::NFA, except it is added to existing POE::Session sessions.

METHODS

This class implements the following methods:

new(@args)

This returns a new wheel object. Its arguments (@args) are passed to setup()

setup()

Do not call this method. It is called by new().

Subclasses should overload this method and use it call provide() to specify which states they define in the current session.

ID()

This returns the unique wheel id of the square wheel.

define($state [, $method ])

Bind $state in the currently active session to the method $method of $self. If $method is omitted, it defaults to the same name as $state.

undefine($state)

Remove the binding of $state in the current session, if and only if it was previously defined by our $self.

provide($state [, $method ])

This is like a delayed define(). It will only occurs when load() is called.

load()

Load all provide'd states.

unload()

This undefines (with undefine()) all states that were defined with define() or provided() and subsequently loaded with load().

on_load

This is method is called as a POE state when the plugin is loaded. $_[KERNEL], $_[SESSION], etc, should all be correct.

on_unload

This is method is called as a POE state when the plugin is unloaded. $_[KERNEL], $_[SESSION], etc, should all be correct.

BUGS

None known. Bug reports are welcome. Please use our bug tracker at http://gna.org/bugs/?func=additem&group=haver.

AUTHOR

Dylan William Hardison, <dylan@haverdev.org>

SEE ALSO

http://www.haverdev.org/, Haver::Wheel::Loader, POE, POE::Session, POE::NFA.

COPYRIGHT and LICENSE

Copyright (C) 2005 by Dylan William Hardison. All Rights Reserved.

This module is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this module; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA