Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: POE, Sessons, POE::Wheel::Run and program flow

by themage (Friar)
on Sep 04, 2008 at 17:22 UTC ( #709071=note: print w/replies, xml ) Need Help??

in reply to POE, Sessons, POE::Wheel::Run and program flow

sub make_a_worker { my ( $postback, $message ) = @_; POE::Session->create( inline_states => { _start => \&worker_start, worker_child_stdout => \&worker_child_stdout, worker_closed => \&worker_closed, sig_child => \&sig_child, }, args => [ @_ ], ); } sub worker_start { my ($kernel, $session, $heap, @args ) = @_[KERNEL, SESSION, HEAP, +ARG0 .. $#_]; $heap->{postback}=$args[0]; $heap->{message}=$args[1]; $heap->{MessageID} = $args[1]->getHeaderField('MessageID'); $heap->{SessionID} = $session->ID; # ... your code as is... print " Message ID: ".$heap->{MessageID}; print " -start_message_process (end): ".$heap->{SessionID}."\n"; } # .... sub worker_closed { my ( $kernel, $heap) = @_[ KERNEL, HEAP]; my $postback=$heap->{postback}; my @results=@{$heap->{results}}; # I don't know how $heap->{results} is created, but I presume it i +s based somehow on the output of your process $postback->(@results); # ... anything you need (yield('sig_child') is not one of that) }

This should do it.

Your problems, create a session (and that include almost any type of component don't ways for the session to end, one create it and add it to the sessions poll, so when you call your callback after create the session you are signaling the JobQueue that the job is done.

Replies are listed 'Best First'.
Re^2: POE, Sessons, POE::Wheel::Run and program flow
by Devanchya (Beadle) on Sep 04, 2008 at 17:59 UTC
    That did it! Thanks.
    Even smart people are dumb in most things...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://709071]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2016-10-25 22:28 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (330 votes). Check out past polls.