in reply to Re^4: how to use angle operator with timeout?
in thread how to use angle operator with timeout?
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" ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: how to use angle operator with timeout?
by BrowserUk (Patriarch) on Feb 04, 2013 at 09:38 UTC | |
by tmharish (Friar) on Feb 04, 2013 at 10:23 UTC | |
by BrowserUk (Patriarch) on Feb 04, 2013 at 10:36 UTC |