The following code is for including an alarm, to kill a CGI-Perl process that is left hanging use CGI; $SIG{'ALRM'} = sub{ die "Error: Timed Outn"); alarm(30);