in reply to determining the line# of code when an alarm() trips?
Have you tried Carp? Seems to work — at least for a simple case like this:
#!/usr/bin/perl use Carp; eval { local $SIG{ALRM} = sub { croak "timed out" }; alarm 3; # ... # have it hang in line 12 my $s = <STDIN>; # ... alarm 0; }; print "$@\n" if $@;
Output (if you let it time out):
timed out at ./645816.pl line 6 main::__ANON__('ALRM') called at ./645816.pl line 12 eval {...} called at ./645816.pl line 12 eval {...} called at ./645816.pl line 5
|
|---|