|
#Im trying to time out an operation...
#the books say it should be done with the following method:
$SIG{ALRM} = sub { die "Timeout" };
eval
{
alarm 3;
chomp($answer = <STDIN>);
alarm 0;
};
#####
but... in my system, when alarm 3 gets execute, the eval function is quitted.
so the timeout never takes place.
also... when i type alarm 3; into a script and its not inside eval{...} then i get an error.
the books claim one should not get an error and im not finding out why the error comes up.
How does one time out an operation?
|
|
|
|
|
|
|
// |