This works on *nix:
use strict ; use warnings ; my $timeout_in = 5 ; eval { local $SIG{ALRM} = sub { die "timed_out\n" }; alarm($timeout_in); while(<>) { alarm($timeout_in); my $in = $_ ; chomp( $in ) ; print $in . "\n" ; last if( $in eq 'exit' ); } alarm(0) ; }; if ($@) { die( "Hey ... whats with the slow typing ??\n" ); }
In reply to Re^5: how to use angle operator with timeout?
by tmharish
in thread how to use angle operator with timeout?
by Mark_Galeck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |