POE::Component::Spread - handle Spread communications in POE
POE::Component::Spread->new( 'spread' ); POE::Session->create( inline_states => { _start => \&_start, chatroom_regular => \&do_something, } ); sub _start { $poe_kernel->alias_set('displayer'); $poe_kernel->post( spread => connect => 'localhost' ); $poe_kernel->post( spread => subscribe => 'chatroom' ); $poe_kernel->post( spread => publish => 'chatroom', 'A/S/L?' ); } sub do_something { my $args = $_[ARG0]; my ($sender, $message, $type, $groups) = @$args; # ... }
POE::Component::Spread is a POE component for talking to Spread servers.
POE::Component::Spread->new( 'spread' );
$poe_kernel->post( spread => connect => '4444@localhost' );
Connect this POE session to the Spread server on port 4444 on localhost.
$poe_kernel->post( spread => subscribe => 'chatroom' );
Subscribe to a Spread messaging group. Admin messages will be sent to your groupname_admin event and regular messages to groupname_regular.
groupname_admin
groupname_regular
$poe_kernel->post( spread => publish => 'chatroom', 'A/S/L?' );
Send a simple message to a Spread group.
Error handling is non-existent (like most of the API).
Theo Schlossnagle wrote Spread.pm without which this wouldn't work. Michael Stevens provided inspiration with his unreleased PoCo::Spread.
This module is free software, and may be distributed under the same terms as Perl itself.
Copyright (C) 2004, Rob Partington <perl-pcs@frottage.org>
To install POE::Component::Spread, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Spread
CPAN shell
perl -MCPAN -e shell install POE::Component::Spread
For more information on module installation, please visit the detailed CPAN module installation guide.