sandrider has asked for the wisdom of the Perl Monks concerning the following question:
It seems my fork isn't working very well. The process seems to have to complete before anything is shown on the webpage. The webpage display part is below} elsif ($url = $cgi->param('url')) { $session = get_session_id(); $cache = get_cache_handle(); $cache->set($session, [0, ""]); #getting the parameters from the cgi object $type = $cgi->param('type'); $mudpit = $cgi->param('mudpit'); $url = $cgi->param('url'); $boldRed = $cgi->param('bold_red'); $maxHits = $cgi->param('max_hits'); if ($pid = fork) { $cgi->delete_all(); $cgi->param('session', $session); print $cgi->redirect($cgi->self_url()); } elsif (defined $pid) { close STDOUT; ($tmpDir, $resDir) = chk_dir($path); $buf = ""; @urlList = split /\n/, $url; foreach (@urlList) { ($link, $fn) = which_svr($_); dl_file($link, $fn, $tmpDir); $buf .= "$fn\n"; $cache->set($session, [0, $buf]); } #$cache->set($session, [1, $buf]); exit; } else { die "Cannot fork: $!"; }
I have $|=1 in my codes. Can anyone tell me what to do to allow the "hold on" page to be displayed while the process the running? Thanks. Desmondif ($session = $cgi->param('session')) { $cache = get_cache_handle(); $data = $cache->get($session); print $cgi->header, $cgi->start_html( -title => 'Extract peptide masses', -style => { src => '/stylesheet.css' }, ($data->[0] ? () : (-head => ["<meta http-equiv=re +fresh content=5>"])) ); #generate HTML document start print '<img src="/icons/title_banner.gif">'; print << 'HTML_END' unless $data->[0]; <h3> <p>The system is now getting the required file(s) and extracti +ng the required information.</p> <p>Please do not close this browser.</p> <p>Links to the result(s) will be displayed when the process i +s done.</p> </h3> HTML_END print $cgi->pre($cgi->escapeHTML($data->[1])); print $cgi->end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: fork problem
by Limbic~Region (Chancellor) on Jun 28, 2005 at 12:59 UTC | |
|
Re: fork problem
by zentara (Cardinal) on Jun 28, 2005 at 12:25 UTC | |
|
Re: fork problem
by etcshadow (Priest) on Jun 28, 2005 at 13:51 UTC |