As the comment /* XXX not good for nested eval */ in pp_ctl.c suggests, goto didn't work properly within nested eval"" statements. Until now. Apply over the others, and I'll see you in the morning :-) .robin. --- perl-robin2/pp_ctl.c.again Wed Mar 14 03:28:50 2001 +++ perl-robin2/pp_ctl.c Wed Mar 14 03:36:37 2001 @@ -2455,6 +2455,7 @@ if (label && *label) { OP *gotoprobe = 0; bool leaving_eval = FALSE; + PERL_CONTEXT *last_eval_cx = 0; /* find label */ @@ -2466,7 +2467,10 @@ case CXt_EVAL: leaving_eval = TRUE; if (CxREALEVAL(cx)) { - gotoprobe = PL_eval_root; /* XXX not good for nested eval */ + gotoprobe = (last_eval_cx ? + last_eval_cx->blk_eval.old_eval_root : + PL_eval_root); + last_eval_cx = cx; break; } /* else fall through */ --- perl-robin2/t/op/goto.t.again Wed Mar 14 03:40:57 2001 +++ perl-robin2/t/op/goto.t Wed Mar 14 04:10:17 2001 @@ -2,7 +2,7 @@ # "This IS structured code. It's just randomly structured." -print "1..21\n"; +print "1..22\n"; while ($?) { $foo = 1; @@ -128,6 +128,21 @@ }; print ($ok&&!$@ ? "ok 21\n" : "not ok 21\n"); + +# Test that goto works in nested eval-string +$ok = 0; +{eval q{ + eval q{ + goto LABEL22; + }; + $ok = 0; + last; + + LABEL22: $ok = 1; +}; +$ok = 0 if $@; +} +print ($ok ? "ok 22\n" : "not ok 22\n"); exit;Thread Next