Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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]
[ambrus]: you already have blackboards and a canvas for projector or overhead transparencies (or positive film slide projector, not used for maths) canvas in the same lecture halls today, and switch in a few minutes between presentations,
[ambrus]: they're only difficult to use together.
[ambrus]: overhead transparencies are a nice convenience by the way that mix the two slides, because you can write them in advance and edit them during the presentation easily. but they're not very much in fasion these days.
[ambrus]: you can even print them.
[Discipulus]: ambrus i'm trying out MremoteNG which wrap putty and rdp and many other things..
[Corion]: ambrus: Yes, ideally you would have the ease of overhead projection transparencies and pens drawing on them, combined with the computer generated slide text...
[Corion]: Maybe the solution would be a tablet (with pens), like the Wacom tablets, but you still need good software and need to know how to operate it well in an interactive setting ;)

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-09-26 10:30 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (293 votes). Check out past polls.