diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2005-05-21 19:15:43 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2005-05-21 19:15:43 +0000 |
commit | c74ace89800a81a764294e9f6eacc04bbed5a568 (patch) | |
tree | 1fa600f949acceb545ad4aa08ff06095f971c8bd /t | |
parent | 7b2c381cf37e4e4611c4a864b5d6f7134344e3e6 (diff) | |
download | perl-c74ace89800a81a764294e9f6eacc04bbed5a568.tar.gz |
disallow eval { goto &foo }
eval 'goto &foo' is already banned, and the try-version usually
coredumps due to the code assuming the CxEVAL is actually a CxSUB.
Anyway exiting an eval but preserving "it's" @_ doesn't make much
sense.
p4raw-id: //depot/perl@24532
Diffstat (limited to 't')
-rwxr-xr-x | t/op/goto.t | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/t/op/goto.t b/t/op/goto.t index ac3e48988d..7f502bd806 100755 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -10,7 +10,7 @@ BEGIN { use warnings; use strict; -plan tests => 54; +plan tests => 56; our $foo; while ($?) { @@ -428,4 +428,11 @@ a32039(); is($r, "ok", 'redo and goto'); } +# goto &foo not allowed in evals + +sub null { 1 }; +eval 'goto &null'; +like($@, qr/Can't goto subroutine from an eval-string/, 'eval string'); +eval { goto &null }; +like($@, qr/Can't goto subroutine from an eval-block/, 'eval block'); |