diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-11-28 22:42:57 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-12-05 21:31:40 -0800 |
commit | 55b37f1c313121c8cbb341aceea93a386169d6fd (patch) | |
tree | 06ce0a27e9dcb996de3150a7c49cbf17c553eb61 /t/op/goto.t | |
parent | 7d7d93ad5efb66d5764017a7a62c90f3b5353986 (diff) | |
download | perl-55b37f1c313121c8cbb341aceea93a386169d6fd.tar.gz |
pp_goto: Call get-magic before choosing goto type
Deciding whether this is goto-label or goto-sub can only correctly
happen after get-magic has been invoked, as get-magic can cause the
argument to begin or cease to be a subroutine reference.
Diffstat (limited to 't/op/goto.t')
-rw-r--r-- | t/op/goto.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/op/goto.t b/t/op/goto.t index 7dafb2a07c..486277dfb5 100644 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -10,7 +10,7 @@ BEGIN { use warnings; use strict; -plan tests => 88; +plan tests => 89; our $TODO; my $deprecated = 0; @@ -663,3 +663,9 @@ eval { my $x = "\0"; goto $x }; like $@, qr/^Can't find label \0 at /, 'goto $x where $x begins with \0'; eval { goto "\0" }; like $@, qr/^Can't find label \0 at /, 'goto "\0"'; + +sub TIESCALAR { bless [pop] } +sub FETCH { $_[0][0] } +tie my $t, "", sub { "cluck up porridge" }; +is eval { sub { goto $t }->() }//$@, 'cluck up porridge', + 'tied arg returning sub ref'; |