alternatives are all welcomed
perldoc perlipc shows how to setup a timeout; you might try to modify it for your needs (untested).
sub getinput { my $default = shift; my $value; eval { local $SIG{ALRM} = sub { die "alarm clock restart" }; alarm 10; # your code here, read <STDIN> $value = ... alarm 0; }; if ($@ and $@ !~ /alarm clock restart/) { return $default } return $value; }
In reply to Re: default value after timeout
by fglock
in thread default value after timeout
by Limbic~Region
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |