Rob Partington
and 1 contributors

NAME

POE::Component::Spread - handle Spread communications in POE

SYNOPSIS

    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;

        # ...
    }

DESCRIPTION

POE::Component::Spread is a POE component for talking to Spread servers.

METHODS

new

    POE::Component::Spread->new( 'spread' );

EVENTS

connect

    $poe_kernel->post( spread => connect => '4444@localhost' );

Connect this POE session to the Spread server on port 4444 on localhost.

subscribe

    $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.

publish

    $poe_kernel->post( spread => publish => 'chatroom', 'A/S/L?' );

Send a simple message to a Spread group.

BUGS

Error handling is non-existent (like most of the API).

CREDITS

Theo Schlossnagle wrote Spread.pm without which this wouldn't work. Michael Stevens provided inspiration with his unreleased PoCo::Spread.

LICENSE

This module is free software, and may be distributed under the same terms as Perl itself.

AUTHOR

Copyright (C) 2004, Rob Partington <perl-pcs@frottage.org>