[task_result] Child process in wheel 8 wrote to STDOUT: HASH(0x9b22c94)
[task_result] Result for cmd: 32240\Kb (1.5%).
[irc_bot_msg] I said '[task_result] Result for cmd: 32240\Kb (1.5%).' to swares
[task_close] Child 30750 has finished.
[on_child] We have lost our children! (POE::Session=ARRAY(0x8fcf1a0))
[on_child] We have lost our children! (POE::Session=ARRAY(0x9adc6d0))
[on_child] We have lost our children! (POE::Session=ARRAY(0x9ad16c4))
[on_child] We have lost our children! (POE::Session=ARRAY(0x9b231f8))
[on_child] We have lost our children! (POE::Session=ARRAY(0x9b23a50))
[on_child] We have lost our children! (POE::Session=ARRAY(0x9ad8d1c))
[on_child] We have lost our children! (POE::Session=ARRAY(0x9adb2e8))
[bot_stop] Stopping.
Can't call method "PID" on an undefined value at ./cookbot.pl line 1694.
####
# handler for child processes (forking job server)
$kernel->sig( CHLD => "task_close" );
####
my $task = POE::Wheel::Run->new(
Program => sub { &{$this_code} },
ProgramArgs => \@program_args,
StdoutFilter => POE::Filter::Reference->new(),
StdinEvent => 'task_stdin', # Flushed all data to the child's STDIN.
StdoutEvent => 'task_result', # Received data from the child's STDOUT.
StderrEvent => 'task_debug', # Received data from the child's STDERR.
# ErrorEvent => 'task_error', # An I/O error occurred.
CloseEvent => 'task_close', # Child closed all output handles.
);
$heap->{task}->{ $task->ID } = $task;
####
# Child close event
sub task_close {
my ($heap, $wheel_id) = @_[HEAP, ARG0];
my $result = $_[ARG0];
my $child = $heap->{task}->{$wheel_id};
print "[task_close] Child ", $child->PID, " has finished.\n";
$child = delete $heap->{task}->{$wheel_id};
}