hi,
I'm trying to create a module with POE. The problem is that as far as I can tell the script doesn't reach the _ready state. Relevant parts of the code are below.
package ParallelDownloader;
use strict;
use Carp;
use POE qw(Component::Client::HTTP);
sub new {
my ($class, $requests)=@_;
my $self={requests=>$requests};
return bless $self, $class;
}
sub go {
my $self=shift;
POE::Component::Client::HTTP->spawn(Alias => 'ua');
POE::Session->create(
inline_states => {
_start => \&_initialize_session,
ready => \&_ready,
download => \&_download,
got_response => \&_got_response
},
heap => {TODO => $self->{requests}}
);
$poe_kernel->run();
return _finished();
}
sub _initialize_session {
my $kernel = $_[KERNEL];
print "at init\n";
$kernel->yield("_ready");
}
sub _ready {
my $kernel=$_[KERNEL];
my $heap=$_[HEAP];
print "at ready\n";
return unless (@{$heap->{TO_GET}}=splice @{$heap->{TODO}}, 0, 5
+);
$kernel->yield("_download");
}
-----------------------------------
Any comments about coding style are welcome.