A
axel
I am puzzled by the strange action of 'goto' (or lack of action) when
an alarm call is caught.
Code:
======================
print "Ready> ";
local $SIG{ALRM} = sub {
print "Nope\n";
goto LAB1;
print "Nope 2\n";
};
alarm 2;
eval { # XXX
$a = <STDIN>;
}; # XXX
$b = alarm (0);
if ($b > 0) {
print "OK: $b: $a";
} else {
print "Seems to have timed out: $a";
}
exit;
LAB1:
print "\nTimed out\n";
exit;
====================== produces:
Ready> Nope
Seems to have timed out:
======================
Removing the eval statements (marked with comments 'XXX' above),
produces:
======================
Ready> Nope
Can't find label LAB1 at ./q1.pl line 8.
======================
Please no flames about the use of 'goto'... I am just curious as to why
it seems to screw up in these circumstances.
Axel
an alarm call is caught.
Code:
======================
print "Ready> ";
local $SIG{ALRM} = sub {
print "Nope\n";
goto LAB1;
print "Nope 2\n";
};
alarm 2;
eval { # XXX
$a = <STDIN>;
}; # XXX
$b = alarm (0);
if ($b > 0) {
print "OK: $b: $a";
} else {
print "Seems to have timed out: $a";
}
exit;
LAB1:
print "\nTimed out\n";
exit;
====================== produces:
Ready> Nope
Seems to have timed out:
======================
Removing the eval statements (marked with comments 'XXX' above),
produces:
======================
Ready> Nope
Can't find label LAB1 at ./q1.pl line 8.
======================
Please no flames about the use of 'goto'... I am just curious as to why
it seems to screw up in these circumstances.
Axel