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]