From: Robin Barker Date: Wed, 26 Sep 2001 17:56:28 +0000 (+0100) Subject: make __ANON__ global X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16920d4e7955f05583cb8e0e238058b2a6125125;p=p5sagit%2Fp5-mst-13.2.git make __ANON__ global Message-Id: <200109261656.RAA27762@tempest.npl.co.uk> p4raw-id: //depot/perl@12251 --- diff --git a/gv.c b/gv.c index 6538377..2ed4809 100644 --- a/gv.c +++ b/gv.c @@ -656,7 +656,7 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type) strEQ(name, "ARGVOUT"))) global = TRUE; } - else if (*name == '_' && !name[1]) + else if (*name == '_' && (!name[1] || strEQ(name,"__ANON__"))) global = TRUE; if (global) diff --git a/t/op/anonsub.t b/t/op/anonsub.t index 0e4c404..fef40f9 100755 --- a/t/op/anonsub.t +++ b/t/op/anonsub.t @@ -97,3 +97,8 @@ sub X { X(); EXPECT ok 1 +######## +package; +print sub { return "ok 1\n" } -> (); +EXPECT +ok 1 diff --git a/t/op/runlevel.t b/t/op/runlevel.t index 60c19a5..03e253e 100755 --- a/t/op/runlevel.t +++ b/t/op/runlevel.t @@ -311,6 +311,7 @@ $SIG{__DIE__} = sub { eval { die }; &{sub { eval 'die' }}(); sub foo { eval { die } } foo(); +{package rmb; sub{ eval{die} } ->() }; # check __ANON__ is global EXPECT In DIE main|-|8|(eval) @@ -320,6 +321,9 @@ main|-|9|main::__ANON__ In DIE main|-|10|(eval) main|-|10|main::foo +In DIE +rmb|-|11|(eval) +rmb|-|11|main::__ANON__ ######## package TEST;