Padre::Role::PubSub - A simple event publish/subscriber role
This class allows the addition of simple publish/subscribe behaviour to an arbitrary class.
$publisher->subscriber( $object, { my_event_one => 'my_handler_method', my_event_two => 'my_handler_method', } );
The <subscriber> method lets you register an object for callbacks to a particular set of method for various named events.
Returns true, or throws an exception if any of the parameters are invalid.
$publisher->unsubscribe($subscriber);
The unsubscribe method removes all event registrations for a particular object.
unsubscribe
Returns true.
$publisher->publish("my_event_one", "param1", "param2");
The publish method is called on the published to emit a particular named event.
publish
It calls any registered event handlers in sequence, ignoring exceptions.
Returns true, or throws an exception if the event name is invalid.
Copyright 2008-2016 The Padre development team as listed in Padre.pm.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install Padre, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Padre
CPAN shell
perl -MCPAN -e shell install Padre
For more information on module installation, please visit the detailed CPAN module installation guide.