Boldra has asked for the wisdom of the Perl Monks concerning the following question:
In perl5.10 the behaviour of a die handler is inconsistent:
$SIG{__DIE__} = sub { print "\$@='$@'\n"; $@='' }; eval {die "string" }; print "\$@='$@'\n"; eval {die { } }; print "\$@='$@'\n";
If the die gets passed a string, the signal handler has a local $@ which is empty, and modifying it doesn't affect the caller. If it gets passed a hashref, it doesn't localize it, and modifying it (calling eval inside sigdie) changes it in the caller's scope.
I know it was fixed by 5.18. I've tried finding it in perldelta, but I think I'm searching for the wrong thing. Does anyone know which Perl version this was fixed in? Thanks.
edit: missing semicolon
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: When was $@ scope in sigdie fixed?
by Apero (Scribe) on Dec 07, 2015 at 11:56 UTC | |
by ikegami (Patriarch) on Dec 08, 2015 at 21:07 UTC | |
by Apero (Scribe) on Dec 09, 2015 at 13:52 UTC | |
by Boldra (Curate) on Dec 07, 2015 at 14:12 UTC | |
|
Re: When was $@ scope in sigdie fixed?
by choroba (Cardinal) on Dec 07, 2015 at 11:59 UTC | |
|
Re: When was $@ scope in sigdie fixed?
by Anonymous Monk on Dec 07, 2015 at 12:02 UTC |