Ship of Theseus
if (my $pid = fork) { # parent # return job ID as JSON my $reply = CGI->new(""); print $reply->header(-type => 'text/html'); print '{"jobID":"' . $jobID . '"}'; exit 0; } elsif (defined $pid) { # child # close STDOUT/STDERR to signal to end CGI session with Apache # Otherwise, the AJAX request to this script won't return properly close STDOUT; close STDERR; } # work continues here in fork ..