diff options
author | Robin Barker <RMBarker@cpan.org> | 2001-09-26 18:56:28 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-09-27 22:44:35 +0000 |
commit | 16920d4e7955f05583cb8e0e238058b2a6125125 (patch) | |
tree | 69e3127affc77f9722ee58bbab6493c028052888 | |
parent | d333a2173e786c391c48ee4f5f7df078b91e90b1 (diff) | |
download | perl-16920d4e7955f05583cb8e0e238058b2a6125125.tar.gz |
make __ANON__ global
Message-Id: <200109261656.RAA27762@tempest.npl.co.uk>
p4raw-id: //depot/perl@12251
-rw-r--r-- | gv.c | 2 | ||||
-rwxr-xr-x | t/op/anonsub.t | 5 | ||||
-rwxr-xr-x | t/op/runlevel.t | 4 |
3 files changed, 10 insertions, 1 deletions
@@ -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 0e4c40494f..fef40f935a 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 60c19a5e4c..03e253e6e6 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; |