POE::Component::NonBlockingWrapper::Base is a POE-based base Perl class for non-blocking wrappers around blocking stuff.
SYNOPSIS
use strict;
use warnings;
package POE::Component::Example;
use POE;
use base 'POE::Component::NonBlockingWrapper::Base';
sub _methods_define {
return ( get_time => '_wheel_entry' );
}
sub get_time {
$poe_kernel->post( shift->{session_id} => get_time => @_ );
}
sub _process_request {
# of course, here you'd normally do your blocking stuff
$_[1]->{time} = localtime;
}
package main;
use POE;
my $poco = POE::Component::Example->spawn;
POE::Session->create( package_states => [ main => [qw(_start results)] ], );
$poe_kernel->run;
sub _start {
$poco->get_time({ event => 'results' });
}
sub results {
print "Current time is: $_[ARG0]->{time}n";
$poco->shutdown;
}
Product's homepage
Requirements:
· Perl