XAS::Lib::POE::PubSub - A publish/subscribe class for POE sessions
use POE; use XAS::Lib::POE::PubSub; my $pubsub = XAS::Lib::POE::PubSub->new(); $pubsub->subscribe('session', 'channel'); $pubusb->publish( -event => 'event', -channel => 'channel', );
This is a very simple channel based publish/subscribe framework for POE. It is implemented as a singleton. It allows you to publish events to all interested sessions.
This method allows you to subscribe to the specified channel.
The session name.
The optional channel to subscribe too. Defaults to 'default'.
This method allows you to unsubscribe from the specified channel.
The optional channel to unsubscribe from. Defaults to 'default'.
This method allows you to publish an event to a specified channel. Additional arguuments can be supplied. It takes the following parameters:
The event to send.
Optional channel. Defaults to 'default'.
Optional additional arguments to send with the event. The context of the arguments is determined by the method that is handling the event. For example:
-args => ['this', 'is', 'neat'] -args => { this => 'is neat' } -args => 'this is neat'
Are all valid arguments.
Kevin L. Esteb, <kevin@kesteb.us>
Copyright (C) 2014 Kevin L. Esteb
This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.
To install XAS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XAS
CPAN shell
perl -MCPAN -e shell install XAS
For more information on module installation, please visit the detailed CPAN module installation guide.