From: Ilya Zakharevich Date: Wed, 27 Sep 2000 18:54:49 +0000 (-0400) Subject: Inside require() $^S was always left undefined. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6dc8a9e4bcd53982379e0df712cfc2dd75d92d2f;p=p5sagit%2Fp5-mst-13.2.git Inside require() $^S was always left undefined. Subject: Re: Tiny 2-byte change to fix debugger's eval bug Message-ID: <20000927185449.A24927@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@7120 --- diff --git a/cop.h b/cop.h index 5b47884..6e8bd91 100644 --- a/cop.h +++ b/cop.h @@ -433,6 +433,7 @@ L. #define EVAL_INEVAL 1 /* some enclosing scope is an eval */ #define EVAL_WARNONLY 2 /* used by yywarn() when calling yyerror() */ #define EVAL_KEEPERR 4 /* set by Perl_call_sv if G_KEEPERR */ +#define EVAL_INREQUIRE 8 /* The code is being required. */ /* Support for switching (stack and block) contexts. * This ensures magic doesn't invalidate local stack and cx pointers. diff --git a/mg.c b/mg.c index 7712cac..1cfaf05 100644 --- a/mg.c +++ b/mg.c @@ -575,9 +575,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) if (PL_lex_state != LEX_NOTPARSING) (void)SvOK_off(sv); else if (PL_in_eval) - sv_setiv(sv, 1); - else - sv_setiv(sv, 0); + sv_setiv(sv, PL_in_eval & ~(EVAL_INREQUIRE)); } break; case '\024': /* ^T */ diff --git a/pp_ctl.c b/pp_ctl.c index 254cce8..c949e78 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2728,7 +2728,9 @@ S_doeval(pTHX_ int gimme, OP** startop) AV* comppadlist; I32 i; - PL_in_eval = EVAL_INEVAL; + PL_in_eval = ((saveop && saveop->op_type == OP_REQUIRE) + ? (EVAL_INREQUIRE | (PL_in_eval & EVAL_INEVAL)) + : EVAL_INEVAL); PUSHMARK(SP); @@ -2891,6 +2893,7 @@ S_doeval(pTHX_ int gimme, OP** startop) CvDEPTH(PL_compcv) = 1; SP = PL_stack_base + POPMARK; /* pop original mark */ PL_op = saveop; /* The caller may need it. */ + PL_lex_state = LEX_NOTPARSING; /* $^S needs this. */ #ifdef USE_THREADS MUTEX_LOCK(&PL_eval_mutex); PL_eval_owner = 0; diff --git a/util.c b/util.c index 6123321..12c30a0 100644 --- a/util.c +++ b/util.c @@ -3606,7 +3606,7 @@ Perl_new_struct_thread(pTHX_ struct perl_thread *t) JMPENV_BOOTSTRAP; - PL_in_eval = EVAL_NULL; /* ~(EVAL_INEVAL|EVAL_WARNONLY|EVAL_KEEPERR) */ + PL_in_eval = EVAL_NULL; /* ~(EVAL_INEVAL|EVAL_WARNONLY|EVAL_KEEPERR|EVAL_INREQUIRE) */ PL_restartop = 0; PL_statname = NEWSV(66,0);