|
|
| |
App::PFM::Abstract(3) |
User Contributed Perl Documentation |
App::PFM::Abstract(3) |
The PFM Abstract class from which the other classes are derived. It defines
shared functions.
- _init()
- Stub init method to ensure it exists.
- _clone()
- Stub clone method to ensure it exists.
- new( [ array @args ] )
- Constructor for all classes based on App::PFM::Abstract.
The args are passed to the _init() methods of
individual classes.
- clone( [ array @args ] )
- Clone one object to create an independent one. By providing a
_clone() method, each class can define which contained objects must
be recursively cloned.
The args are passed to the _clone() methods of
individual classes.
- register_listener(string $event_name, coderef
$code)
- Register the code reference provided as listener for the specified event.
For an example, see below under fire().
- unregister_listener(string $event_name [ , coderef
$code ] )
- If a code argument is provided, unregisters it as listener for the
specified event. If no code argument is provided, unregisters all
listeners for the specified event.
- fire(App::PFM::Event $event)
- Fire an event. Calls all event handlers that have registered themselves.
Returns the handler results as an array or joined string, or '0 but
true' if there are no handlers.
Example usage:
package Parent;
sub start()
{
my $onGreet = sub {
my $event = shift;
my $who = $event->{data};
system "xmessage 'Hello, $who!'";
};
$child = new Child();
$child->register_listener('greetWorld', $onGreet);
$child->do_something();
}
package Child;
sub do_something()
{
my $self = shift;
$self->fire(App::PFM::Event->new({
name => 'greetWorld',
data => 'Fred'
}));
}
- debug()
- Dumps the contents of this object using Data::Dumper(3pm).
Primarily used for debugging.
Visit the GSP FreeBSD Man Page Interface. Output converted with ManDoc. |