in reply to Re^2: simple timeout
in thread simple timeout

also the actual `perldoc -f alarm` example doesn't seem to work either.

eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm 2; `dir /s c:`; alarm 0; };

Surely alarm should interrupt the timeconsuming `dir /s c:` (recursive dir) after 2 seconds?

Replies are listed 'Best First'.
Re^4: simple timeout
by zejames (Hermit) on Nov 08, 2004 at 14:30 UTC
      Tried using Time::Hires;

      use Time::HiRes qw (ualarm setitimer); ualarm(5000); exit;

      returns "ualarm is not a valid Time::HiRes macro at C:/Perl/lib/Time/HiRes.pm line 27."

      Not having much luck here. =(