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.