I have two perl files. in file1 if there is any error and executing continuously without exiting from the command prompt then how i have to implement timer. i am trying the below just for checking, but its not working.
$timeout=5; eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; $nread = system('F:\perl1.pl'); alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; # propagate unexpected errors print "process terminated\n";} else { # didn't }
In reply to How to use timeout in perl by vasuperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |