vasuperl has asked for the wisdom of the Perl Monks concerning the following question:
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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to use timeout in perl
by blindluke (Hermit) on Jan 08, 2015 at 13:35 UTC | |
by vasuperl (Acolyte) on Jan 09, 2015 at 05:05 UTC | |
by Anonymous Monk on Jan 09, 2015 at 07:20 UTC | |
|
Re: How to use timeout in perl
by Anonymous Monk on Jan 08, 2015 at 14:12 UTC |