summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cop.h1
-rw-r--r--mg.c4
-rw-r--r--pp_ctl.c5
-rw-r--r--util.c2
4 files changed, 7 insertions, 5 deletions
diff --git a/cop.h b/cop.h
index 5b47884cb8..6e8bd91e42 100644
--- a/cop.h
+++ b/cop.h
@@ -433,6 +433,7 @@ L<perlcall>.
#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 7712cace8d..1cfaf051e3 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 254cce8692..c949e789a1 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 6123321d28..12c30a0458 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);