summaryrefslogtreecommitdiff
path: root/t/cmd
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-09-06 20:32:47 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:45:08 -0700
commitebfebee40d0932ec522c6781a1405d871fab3ca1 (patch)
treee20c37cc4ccd4f4259458c00f76cde82d447d3f5 /t/cmd
parentcf748c3cf2f8037fd170d42f370bc36a48de92ad (diff)
downloadperl-ebfebee40d0932ec522c6781a1405d871fab3ca1.tar.gz
Use the same outside logic for mysubs and formats
By using find_runcv_where both for formats and my subs nested in inner clonable subs, we can simplify the code. It happens to make this work ($x is visible): use 5.01; sub not_lexical8 { my sub foo; foo(); sub not_lexical9 { my sub bar { my $x = 'khaki car keys for the khaki car'; not_lexical8(); sub foo { warn $x } } bar() } } not_lexical9(); This is definitely iffy code, but if making it work makes the imple- mentation simpler, so why not?
Diffstat (limited to 't/cmd')
-rw-r--r--t/cmd/lexsub.t18
1 files changed, 17 insertions, 1 deletions
diff --git a/t/cmd/lexsub.t b/t/cmd/lexsub.t
index 7f6df177e1..f982a0e82f 100644
--- a/t/cmd/lexsub.t
+++ b/t/cmd/lexsub.t
@@ -8,7 +8,7 @@ BEGIN {
*bar::like = *like;
}
no warnings 'deprecated';
-plan 117;
+plan 118;
# -------------------- our -------------------- #
@@ -528,6 +528,22 @@ sub make_anon_with_my_sub{
is $@, "Undefined subroutine &x called at $f line $l.\n",
'Vivified sub is correctly named';
}
+sub not_lexical10 {
+ my sub foo;
+ foo();
+ sub not_lexical11 {
+ my sub bar {
+ my $x = 'khaki car keys for the khaki car';
+ not_lexical10();
+ sub foo {
+ is $x, 'khaki car keys for the khaki car',
+ 'mysubs in inner clonables use the running clone of their CvOUTSIDE'
+ }
+ }
+ bar()
+ }
+}
+not_lexical11();
# -------------------- Interactions (and misc tests) -------------------- #