This shouldn't be difficult, but I have to admit that I'm stumped with this one and would appreciate any advice.<br><br>I'm working on a form so that someone can submit data, it gets saved to a file, and the user gets a nice little thank you screen that goes into a redirect mode until a forked process completes its analysis of the data.
<br><br>The problem I'm hitting is that the parent process seems to hang around and won't invoke the meta redirect until the exec in the child is done. This doesn't make sense to me.<br><br>Here is the snippet:<br><br>#!/usr/bin/perl
<br>use CGI qw(:standard);<br><br>if (param('submit') ne '') {<br> my $seq = param('seq');<br> # $seq gets cleaned up and saved out to a specific location<br><br> # fork submitted, start redirecting for polling for results
<br> print header, "<html><head>",<br> qq~<META HTTP-EQUIV="Refresh" CONTENT="0;URL=PATH_TO_POLLING_FOR_RESULTS_PROGRAM?refresh=1">~,<br> "</head><body><h2>Sequence Submitted!</h2>Redirecting ...</body></html>\n";
<br><br> # double-fork trick because of zombies (got this from some web searching)<br> unless ($pid = fork) {<br> unless (fork) {<br> exec("PATH_TO_ANALYSIS_PROGRAM", "0041"); # 0041 is a hard coded ARG value for now
<br> exit(0);<br> }<br> exit(0);<br> }<br><br> # fork submitted, start redirecting for polling for results<br> exit(0);<br>}<br><br>Thank you.<br><br>- Glenn<br><br>