In perl, the alarm function can be used to prevent timeouts. This is useful in, for example, CGI scripts where you run the risk of having the browser timeout the connection.

First off you need to set up the alarm with something like

$| = 1;                           #  force autoflush
use constant ALARM_TIME => 15;    # seconds between alarm signals
$SIG{ALRM} = sub { print "."; alarm ALARM_TIME; }

then later on in your script, you turn the alarm on before the process that times out is called.

alarm 1; # turn on alarm [...] # some process that takes forever to run alarm 0; # turn off alarm

See the perlfunc and perlipc man pages for more information.