Padre::Role::PubSub(3) 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.



The "unsubscribe" method removes all event registrations for a particular object.

Returns true.


  $publisher->publish("my_event_one", "param1", "param2");

The "publish" method is called on the published to emit a particular named event.

It calls any registered event handlers in sequence, ignoring exceptions.

Returns true, or throws an exception if the event name is invalid.


Copyright 2008-2013 The Padre development team as listed in

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.