POE::Component::Omegle - Simple POE wrapper around WWW::Omegle
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"; }
This module makes it easy to run multiple Omegle bots using asynchronous HTTP calls.
None by default.
POE::Component::Omegle is just a thin wrapper around the methods in WWW::Omegle. See that module for the other available commands
This method will poll for outstanding requests to process, it's good to call frequently.
WWW::Omegle, POE
Mischa Spiegelmock, <revmischa@cpan.org>
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.
To install POE::Component::Omegle, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Omegle
CPAN shell
perl -MCPAN -e shell install POE::Component::Omegle
For more information on module installation, please visit the detailed CPAN module installation guide.