On Wed, 19 Jul 2006, Jerry D. Hedden wrote:
> In the above, the thread 'die's which results in a warning. (In
> and of itself, this would not terminate the application.) The
> warning is then intercepted by the thread's warning handler which
> subsequently executes an 'exit'. This results in the whole
> application terminating.
I do understand that, it just doesn't feel right to me. A call to
die() should be roughly equivalent to:
sub die {
&{$SIG{__DIE__}}($_[0]) if defined $SIG{__DIE__};
if ($^S) {
$@ = $_[0] || "Died";
# append "at ..." to $@
# throw exception caught by eval block (longjmp)
}
exit($! || ($? >> 8) || 255);
}
I don't understand why you would call the __WARN__ handler instead
of the __DIE__ handler just because this is not the main thread, and
why die() without an eval block would not terminate the application
the same way as a call to exit().
I don't understand the reasoning why die() outside an eval block
should be treated differently from the exit(). You can use all the
same reasoning that it should terminate the application as you can
for the exit() case.
Cheers,
-Jan