- or download this
#!/usr/bin/perl -w
use strict;
...
};
print "$@" if $@;
print "$elapsed\n";
- or download this
5.006
alarm-timeout signal at /home/jbho/bin/test_SIGALRM.pl line 15.
Died at /home/jbho/bin/test_SIGALRM.pl line 16.
0.999504
- or download this
5.008
alarm-timeout signal at /home/jbho/bin/test_SIGALRM.pl line 15.
Died at /home/jbho/bin/test_SIGALRM.pl line 16.
109.948451
- or download this
use POSIX ':signal_h';
my $alarm = 0;
sigaction SIGALRM, new POSIX::SigAction sub { $alarm = 1 }
or die "Error setting SIGALRM handler: $!\n";