$SIG{CHLD} = 'IGNORE'; # ignore dead children, to avoid zombie processes my $child = fork(); if ($child) { # parent; return data $self->return_data( { data => $data } ); } else { # child; run external process my $child_output; eval { # gather a whole lot of data; assemble $external_command use IPC::System::Simple 'capture'; $child_output = capture($external_command); }; $self->log("Error when running [$external_command]: $child_output") if $child_output; $self->log("Error when running [$external_command]: $@") if $@; CORE::exit(0); }