summaryrefslogtreecommitdiff
path: root/t/cmd
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-09-06 16:03:20 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:45:07 -0700
commit4e85e1b4de5848696dc021f24d071090d387fe70 (patch)
treeaf3eb30b733bcf0c6650f5976e4ed27798c4e0c2 /t/cmd
parent9ccc915ef51db520896c2ca075446d61eaef1870 (diff)
downloadperl-4e85e1b4de5848696dc021f24d071090d387fe70.tar.gz
‘Subroutine "&x" is not available’ during compilation
sub { my $x; sub { eval '$x' } }->()() __END__ Variable "$x" is not available at (eval 1) line 2. That one’s OK (though I wonder about the line number). sub { my sub x {}; sub { eval '\&x' } }->()() __END__ Variable "&x" is not available at (eval 1) line 1. That should say ‘Subroutine’.
Diffstat (limited to 't/cmd')
-rw-r--r--t/cmd/lexsub.t24
1 files changed, 23 insertions, 1 deletions
diff --git a/t/cmd/lexsub.t b/t/cmd/lexsub.t
index 02ebac72c5..c3934ba374 100644
--- a/t/cmd/lexsub.t
+++ b/t/cmd/lexsub.t
@@ -8,7 +8,7 @@ BEGIN {
*bar::like = *like;
}
no warnings 'deprecated';
-plan 113;
+plan 115;
# -------------------- our -------------------- #
@@ -489,6 +489,28 @@ sub make_anon_with_my_sub{
eval "#line 56 pygpyf\nsub redef {}";
is $w, "Subroutine redef redefined at pygpyf line 56.\n",
"sub redefinition warnings from my subs";
+
+ undef $w;
+ sub {
+ my sub x {};
+ sub { eval "#line 87 khaki\n\\&x" }
+ }->()();
+ is $w, "Subroutine \"&x\" is not available at khaki line 87.\n",
+ "unavailability warning during compilation of eval in closure";
+
+ undef $w;
+ no warnings 'void';
+ eval <<'->()();';
+#line 87 khaki
+ sub {
+ my sub x{}
+ sub not_lexical8 {
+ \&x
+ }
+ }
+->()();
+ is $w, "Subroutine \"&x\" is not available at khaki line 90.\n",
+ "unavailability warning during compilation of named sub in anon";
}
# -------------------- Interactions (and misc tests) -------------------- #