From 971ecbe6f2aaf71c3a71c08000760f3d4f9bf287 Mon Sep 17 00:00:00 2001 From: Dave Mitchell Date: Sat, 24 May 2003 13:25:17 +0100 Subject: [PATCH] Re: [perl #22299] goto doesn't find label Date: Sat, 24 May 2003 12:25:17 +0100 Message-ID: <20030524112517.GA11761@fdgroup.com> Subject: [PATCH] Re: [perl #22299] goto doesn't find label From: Dave Mitchell Date: Mon, 26 May 2003 13:47:11 +0100 Message-ID: <20030526124710.GA17670@fdgroup.com> p4raw-id: //depot/perl@19625 --- pp_ctl.c | 2 +- t/op/goto.t | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/pp_ctl.c b/pp_ctl.c index 2380d5d..f726ab7 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2402,7 +2402,7 @@ PP(pp_goto) switch (CxTYPE(cx)) { case CXt_EVAL: leaving_eval = TRUE; - if (CxREALEVAL(cx)) { + if (!CxTRYBLOCK(cx)) { gotoprobe = (last_eval_cx ? last_eval_cx->blk_eval.old_eval_root : PL_eval_root); diff --git a/t/op/goto.t b/t/op/goto.t index 8a39d9a..c156fd8 100755 --- a/t/op/goto.t +++ b/t/op/goto.t @@ -2,7 +2,14 @@ # "This IS structured code. It's just randomly structured." -print "1..29\n"; +BEGIN { + chdir 't' if -d 't'; + @INC = qw(. ../lib); +} + +print "1..30\n"; + +require "test.pl"; while ($?) { $foo = 1; @@ -196,6 +203,24 @@ for ($i=0; $i<2; $i++) { } print "ok 29 - goto in for(;;) with continuation\n"; +# bug #22299 - goto in require doesn't find label + +open my $f, ">goto01.pm" or die; +print $f <<'EOT'; +package goto01; +goto YYY; +die; +YYY: print "OK\n"; +1; +EOT +close $f; + +curr_test(30); +my $r = runperl(prog => 'use goto01; print qq[DONE\n]'); +is($r, "OK\nDONE\n", "goto within use-d file"); +unlink "goto01.pm"; + + exit; bypass: -- 1.8.3.1