I try to achieve a timer with several loops as below
while ( $try < 3) {
eval {
local $SIG{ALRM} = {};
alarm 3;
$ret = # sending request and wait for response
alarm 0;
}
last if defined($ret);
$try++;
}
But actually, when the alarm expired, the whole 'while' loop got interrupted, and the loop didn't happen at all.
Where I got the thing wrong?