in reply to Setting the max execution time?

alarm would be one way:

my $OLD_SIG = $SIG{ALRM} if $SIG{ALRM}; $SIG{ALRM} = sub { die "timeout" }; eval { alarm( 30 ); # do what needs to be done alarm( 0 ); }; if( $@ ) { if( $@ =~ /^timeout$/ ) { print STDERR "A timeout occurred"; alarm(0); } else { print STDERR "Some other error occurred"; } } $SIG{ALRM} = $OLD_SIG if $OLD_SIG;

-derby

update: Whoa! Mis-read your question as not more than 30 seconds. I'm not sure why you would want it to run for at least 30 seconds but you could sleep.