in reply to Parallel::ForkManager run_on_finish exit code handler
Use a closure:
my $stats = []; my $code = create_closure( $stats ); .... $pm->run_on_finish( $code ); .... print Dumper( $stats ); sub create_closure { my( $stats ) = @_; return sub { my ($pid, $exit_code, $ident) = @_; push( @$stats, { pid => $pid, exit_code => $exit_code, ident => $ident } ); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parallel::ForkManager run_on_finish exit code handler
by ikegami (Patriarch) on Sep 08, 2009 at 16:07 UTC | |
by derby (Abbot) on Sep 08, 2009 at 16:21 UTC | |
by ikegami (Patriarch) on Sep 08, 2009 at 17:15 UTC |