The wheel goes out of scope. Making it global will suffice but usually it
gets stuffed into the HEAP. Of course it needs to detect the death of the
child and delete the wheel to order to have a clean shutdown.
On Mon, 5 Jun 2006 07:31:13 -0700 (PDT) Mike Schilli wrote:
+------------------
| I don't seem to get POE::Wheel::Run working with a subroutine.
|
| It's emitting text to STDOUT, which should trigger a "captured" event
| in POE. Do you know why the script below never reaches the
| "captured" state?
|
| 2006/06/04 21:36:44 child sleeping
| 2006/06/04 21:36:44 done printing
|
| use POE qw(Wheel::Run);
| use Log::Log4perl qw(:easy);
|
| Log::Log4perl->easy_init({
| level => $DEBUG,
| file => ">>/tmp/wheel.log"});
|
| POE::Session->create(
| inline_states => {
| _start => sub {
| my $w = POE::Wheel::Run->new(
| Program => sub { DEBUG "child sleeping";
| $|++; print "foo\n";
| DEBUG "done printing";
| sleep 10;
| },
| StdoutEvent => "captured",
| )},
| captured => sub {
| my ($heap, $input, $wheel_id) = @_[HEAP, ARG0, ARG1];
| DEBUG "Child process in wheel $wheel_id wrote to STDOUT: $input";
| }
| }
| );
|
| -- Mike
|
| Mike Schilli
| [EMAIL PROTECTED]
+------------------
--
Chris Fedde
303 773 9134