develooper Front page | perl.perl5.porters | Postings from February 2003

[perl #20823] BEGIN { local $@; die 'foo' } doesn't die

Thread Next
From:
Yitzchak Scott-Thoennes
Date:
February 11, 2003 12:58
Subject:
[perl #20823] BEGIN { local $@; die 'foo' } doesn't die
Message ID:
rt-20823-50737.6.35435599348924@bugs6.perl.org
# New Ticket Created by  Yitzchak Scott-Thoennes 
# Please include the string:  [perl #20823]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=20823 >


s silently
Date: Mon, 10 Feb 2003 12:33:19 -0800
Organization: bs"d
Message-ID: <PyAS+gzkgq9E092yn@efn.org>
Lines: 15

BEGIN { local $@; die 'foo' } seems to bail out of the BEGIN, but doesn't
actually die, as if the BEGIN was an eval.

Compare:
~ $perl -wle'BEGIN {local $@; die "foo"; print "bar"} print "baz"'
baz
~ $perl -wle'{local $@; die "foo"; print "bar"} print "baz"'
foo at -e line 1.
~ $perl -wle'BEGIN {die "foo"; print "bar"} print "baz"'
foo at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
~ $

Same results with 5.6.1, 5.8.0, maint snapshot, and not-so-recent-blead.
CHECK, INIT, and END blocks also misbehave.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About