NAME POE::Component::WWW::OhNoRobotCom::Search - non-blocking POE based wrapper around WWW::OhNoRobotCom::Search module SYNOPSIS use strict; use warnings; use POE qw(Component::WWW::OhNoRobotCom::Search); my $poco = POE::Component::WWW::OhNoRobotCom::Search->spawn; POE::Session->create( package_states => [ main => [qw(_start results )] ], ); $poe_kernel->run; sub _start { $poco->search( { term => 'foo', comic_id => 56, # XKCD comics event => 'results', } ); } sub results { my $in_ref = $_[ARG0]; exists $in_ref->{error} and die "ZOMG! ERROR!: $in_ref->{error}"; print "Results for XKCD comic search are as follows:\n"; keys %{ $in_ref->{results} }; while ( my ( $uri, $title ) = each %{ $in_ref->{results} } ) { print "$title [ $uri ]\n"; } $poco->shutdown; } Using event based interface is also possible of course. DESCRIPTION The module is a non-blocking wrapper around WWW::OhNoRobotCom::Search which provides interface to search CONSTRUCTOR spawn my $poco = POE::Component::WWW::OhNoRobotCom::Search->spawn; POE::Component::WWW::OhNoRobotCom::Search->spawn( alias => 'robo', obj_args => { timeout => 10, }, options => { debug => 1, trace => 1, # POE::Session arguments for the component }, debug => 1, # output some debug info ); The "spawn" method returns a POE::Component::WWW::OhNoRobotCom::Search object. It takes a few arguments, *all of which are optional*. The possible arguments are as follows: alias POE::Component::WWW::OhNoRobotCom::Search->spawn( alias => 'robo' ); Optional. Specifies a POE Kernel alias for the component. obj_args POE::Component::WWW::OhNoRobotCom::Search->spawn( obj_args => { timeout => 10, } ); Optional. The "obj_args" argument takes a hashref as a value which will be dereferenced directly into WWW::OhNoRobotCom::Search constructor. See documentation for WWW::OhNoRobotCom::Search for more details. Defaults to: empty (default WWW::OhNoRobotCom::Search constructor) options my $poco = POE::Component::WWW::OhNoRobotCom::Search->spawn( options => { trace => 1, default => 1, }, ); Optional. A hashref of POE Session options to pass to the component's session. debug my $poco = POE::Component::WWW::OhNoRobotCom::Search->spawn( debug => 1 ); When set to a true value turns on output of debug messages. Defaults to: 0. METHODS search $poco->search( { event => 'event_for_output', term => 'foo', comic_id => 56, include => [ qw(all_text meta) ], max_results => 20, lucky => 1, _blah => 'pooh!', session => 'other', } ); Takes a hashref as an argument, does not return a sensible return value. See "search" event's description for more information. session_id my $poco_id = $poco->session_id; Takes no arguments. Returns component's session ID. shutdown $poco->shutdown; Takes no arguments. Shuts down the component. ACCEPTED EVENTS search $poe_kernel->post( robo => search => { event => 'event_for_output', term => 'foo', comic_id => 56, include => [ qw(all_text meta) ], max_results => 20, lucky => 1, _blah => 'pooh!', session => 'other', } ); Instructs the component to perform the search. Takes a hashref as an argument, the possible keys/value of that hashref are as follows: event { event => 'results_event', } Mandatory. Specifies the name of the event to emit when results are ready. See OUTPUT section for more information. term { term => 'foo' } Mandatory. Specifies the term to search for. The first argument (mandatory) is the term you want to search. The other, optional, arguments are given in a key/value fashion and are as follows: comic_id { comic_id => 56 } Optional. The "comic_id" argument takes a scalar as a value which should be a comic ID number or an empty string which indicates that search should be done on all comics. To obtain the comic ID number go to , "View Source" and search for the name of the comic, when you'll find an