Another way may be to use a redirected 'holding pattern' script that checks a semaphore set by your main program. You could even show updates - number of files processed etc.
If your main script creates a temp file that it periodically writes a status to, and deleted when finished, it could pass this filename to "holding.cgi", which can then periodically display the status, then the results when finished - something like this...
#Main File
use File::Temp;
my ($fh, $filename) = tempfile( DIR => '/tmp');
my ($hfh, $results) = tempfile( DIR => '/html');
print redirect("holding.cgi?file=$filename&html=$results");
do {
# process record
print $fh $num_records,"\n" unless ($num_processed++ % 1000);
} while($records_not_processed);
# write results to $hfh
# ...or just results.htm...
# ...if you haven't got multiple users / datasets etc.
unlink $filename;
#Holding.cgi
my $filename=param('file');
my $html=param('html');
if (-e $filename) {
open FILE $filename;
# read in last number
# print some HTML...
# ...that's got a META refresh in...
# ...that points back to ourself
close FILE;
}
else {print redirect($html);}
Cheers, Ben.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|