If this is for cgi scripts, the timeouts usually occur after an interval of inactivity, not just a total running time. So, for some internal scripts at work, in the portions of the script that process for a while without any output, we send some minimal output every so many iterations, so that there is never more than a few seconds of perceived inactivity by the web server. we will generally send a period "." or some other character every so often (usually as hidden data). the code would be something like this:
print "<DIV style="display: none;">
my $count = 0;
while ( long_process_loop) {
# process
...
...
$count++;
if ( !($count % 1000) ) {
print ".";
}
}
print "</DIV>\n";
you may need to play with the frequency of output, and may also need to force unbuffered output ($|++), according to the situation.