Class::Listener - executes methods on events
use Class::Listener; { package My::Listener; our @ISA = qw(Class::Listener); sub new { bless [], 'My::Listener'; } sub _on_event { print "event received"; } } my $l = My::Listener->new(); # call '_on_event' method $l->Class::Listener::signal( 'event', @args );
A base class which listenes for signals and runs methods.
A method with the name "_on_$eventname" will be called (if it exists).
This array is forwarded to the callback.
[Note] signal returns the resulting return value of the callback.
None by default.
Murat Uenalan, <muenalan@cpan.org>
Class::Proxy.
To install Class::Listener, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Listener
CPAN shell
perl -MCPAN -e shell install Class::Listener
For more information on module installation, please visit the detailed CPAN module installation guide.