summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRick Delaney <rick@consumercontact.com>2003-09-23 08:14:52 -0400
committerAbhijit Menon-Sen <ams@wiw.org>2003-10-06 17:30:31 +0000
commit4d8b06f1629b5d0007e3c48de953ec16cd80d51f (patch)
tree4f80e3b3db4d1b15daead9aa5bcefa8acd77866b /pp_ctl.c
parent0b1f57502e82e7086eb37fa5981c91be8f02c535 (diff)
downloadperl-4d8b06f1629b5d0007e3c48de953ec16cd80d51f.tar.gz
(was Re: require() does not behave aas documented)
Message-ID: <20030923121452.G18845@biff.bort.ca> p4raw-id: //depot/perl@21415
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 37e5c0ba63..5a7fdaa739 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1402,6 +1402,9 @@ Perl_die_where(pTHX_ char *message, STRLEN msglen)
if (optype == OP_REQUIRE) {
char* msg = SvPVx(ERRSV, n_a);
+ SV *nsv = cx->blk_eval.old_namesv;
+ (void)hv_store(GvHVn(PL_incgv), SvPVX(nsv), SvCUR(nsv),
+ &PL_sv_undef, 0);
DIE(aTHX_ "%sCompilation failed in require",
*msg ? msg : "Unknown error\n");
}
@@ -2842,7 +2845,7 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq)
sv_setpv(ERRSV,"");
if (yyparse() || PL_error_count || !PL_eval_root) {
SV **newsp; /* Used by POPBLOCK. */
- PERL_CONTEXT *cx;
+ PERL_CONTEXT *cx = &cxstack[cxstack_ix];
I32 optype = 0; /* Might be reset by POPEVAL. */
STRLEN n_a;
@@ -2861,6 +2864,9 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq)
LEAVE;
if (optype == OP_REQUIRE) {
char* msg = SvPVx(ERRSV, n_a);
+ SV *nsv = cx->blk_eval.old_namesv;
+ (void)hv_store(GvHVn(PL_incgv), SvPVX(nsv), SvCUR(nsv),
+ &PL_sv_undef, 0);
DIE(aTHX_ "%sCompilation failed in require",
*msg ? msg : "Unknown error\n");
}
@@ -3049,9 +3055,12 @@ PP(pp_require)
DIE(aTHX_ "Null filename used");
TAINT_PROPER("require");
if (PL_op->op_type == OP_REQUIRE &&
- (svp = hv_fetch(GvHVn(PL_incgv), name, len, 0)) &&
- *svp != &PL_sv_undef)
- RETPUSHYES;
+ (svp = hv_fetch(GvHVn(PL_incgv), name, len, 0))) {
+ if (*svp != &PL_sv_undef)
+ RETPUSHYES;
+ else
+ DIE(aTHX_ "Compilation failed in require");
+ }
/* prepare to compile file */