summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-08-29 20:18:23 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-08-29 21:50:43 -0700
commit211a4342c9ab2a1353f618cb96de02610eaa1989 (patch)
tree57e83e8ad42d795ee4b26c23367b0c91af3651f3 /t
parentcff06bc4e9340e61387bd9505055ed3a19aa25ef (diff)
downloadperl-211a4342c9ab2a1353f618cb96de02610eaa1989.tar.gz
Avoid vivifying stuff when looking up barewords
Till now, when a bareword was looked up to see whether it was a sub- routine, an rv2cv op was created (to allow PL_check hooks to override the process), which was then asked for its GV. Afterwards, the GV was downgraded back to nothing if possible. So a lot of the time a GV was autovivified and then discarded. This has been the case since f74617600 (5.12). If we know there is a good chance that the rv2cv op is about to be deleted, we can avoid that by passing a flag to the new op. Also f74617600 actually changed the behaviour by vivifying stashes that used not be vivified: sub foo { print shift, "\n" } SUPER::foo bar if 0; foo SUPER; Output in 5.10: SUPER Output as of this commit: SUPER Output in 5.12 to 5.21.3: Can't locate object method "foo" via package "SUPER" at - line 3.
Diffstat (limited to 't')
-rw-r--r--t/op/stash.t11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/op/stash.t b/t/op/stash.t
index 598811487d..4c846b7ec4 100644
--- a/t/op/stash.t
+++ b/t/op/stash.t
@@ -7,7 +7,7 @@ BEGIN {
BEGIN { require "./test.pl"; }
-plan( tests => 49 );
+plan( tests => 50 );
# Used to segfault (bug #15479)
fresh_perl_like(
@@ -318,3 +318,12 @@ ok eval '
sub foo{};
1
', 'no crashing or errors when clobbering the current package';
+
+# Bareword lookup should not vivify stashes
+is runperl(
+ prog =>
+ 'sub foo { print shift, qq-\n- } SUPER::foo bar if 0; foo SUPER',
+ stderr => 1,
+ ),
+ "SUPER\n",
+ 'bareword lookup does not vivify stashes';