if (!defined $child) { $self->log("Error when running [$external_command]: fork failed: $!"); } else if ($child) { # parent; return data ....