yoda54 has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w $SIG{ALRM} = sub { command() }; command(); if ($@) { if ($@ =~ /timeout/) { command(); } else { alarm(0); # clear the still-pending alarm die; # propagate unexpected exception } } sub command { my $date = `date`; chomp($date); alarm(5); print "\n"; print "prompt $date > "; <>; alarm(0); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Timeout on STDIN
by VSarkiss (Monsignor) on Jul 19, 2004 at 20:34 UTC | |
|
Re: Timeout on STDIN
by BUU (Prior) on Jul 19, 2004 at 20:38 UTC | |
|
Re: Timeout on STDIN
by gmpassos (Priest) on Jul 20, 2004 at 00:29 UTC | |
|
Re: Timeout on STDIN
by zentara (Cardinal) on Jul 20, 2004 at 12:54 UTC | |
by boleary (Scribe) on Oct 12, 2016 at 13:39 UTC | |
by soonix (Chancellor) on Oct 14, 2016 at 09:35 UTC | |
by boleary (Scribe) on Oct 24, 2016 at 10:52 UTC | |
by soonix (Chancellor) on Oct 24, 2016 at 11:43 UTC | |
|