Mischa Spiegelmock > POE-Component-Omegle > POE::Component::Omegle

Download:
POE-Component-Omegle-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

POE::Component::Omegle - Simple POE wrapper around WWW::Omegle

SYNOPSIS ^

        use POE;

        POE::Session->create(
                             package_states => [
                                                OMPoeBot => [qw/
                                                             _start om_connect om_chat om_disconnect poke
                                                             /],
                                                ],
                             );

        $poe_kernel->run;

        package OMPoeBot;
        use POE qw/Component::Omegle/;

        sub _start {
            my ($heap) = $_[HEAP];

            my $om = POE::Component::Omegle->new;

            $om->set_callback(connect    => 'om_connect');
            $om->set_callback(chat       => 'om_chat');
            $om->set_callback(disconnect => 'om_disconnect');

            $heap->{om} = $om;
    
            $om->start_chat;
            $poe_kernel->delay_add(poke => 0.1, $om);
        }

        sub poke {
            my ($kernel, $heap, $om) = @_[KERNEL, HEAP, ARG0];

            $om->poke;
            $poe_kernel->delay_add(poke => 0.1, $om);
        }

        sub om_connect {
            my $om = $_[HEAP]->{om};

            print "Stranger connected\n";
            $om->say("Yo homie! Where you at?");
        }

        sub om_chat {
            my ($cb_args) = $_[ARG1];
            my ($om, $chat) = @$cb_args;

            print ">> $chat\n";
        }

        sub om_disconnect { print "Stranger disconnected\n"; }

DESCRIPTION ^

This module makes it easy to run multiple Omegle bots using asynchronous HTTP calls.

EXPORT

None by default.

METHODS ^

POE::Component::Omegle is just a thin wrapper around the methods in WWW::Omegle. See that module for the other available commands

poke

This method will poll for outstanding requests to process, it's good to call frequently.

SEE ALSO ^

WWW::Omegle, POE

AUTHOR ^

Mischa Spiegelmock, <revmischa@cpan.org>

COPYRIGHT AND LICENSE ^

Copyright (C) 2009 by Mischa Spiegelmock

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: