summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 5d2d10f94c..d488b7ce37 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3032,6 +3032,7 @@ PP(pp_require)
GV *filter_child_proc = 0;
SV *filter_state = 0;
SV *filter_sub = 0;
+ SV *hook_sv = 0;
sv = POPs;
if (SvNIOKp(sv)) {
@@ -3230,6 +3231,7 @@ trylocal: {
LEAVE;
if (tryrsfp) {
+ hook_sv = dirsv;
break;
}
@@ -3319,7 +3321,9 @@ trylocal: {
/* Assume success here to prevent recursive requirement. */
(void)hv_store(GvHVn(PL_incgv), name, strlen(name),
- newSVpv(CopFILE(&PL_compiling), 0), 0 );
+ (hook_sv ? SvREFCNT_inc(hook_sv)
+ : newSVpv(CopFILE(&PL_compiling), 0)),
+ 0 );
ENTER;
SAVETMPS;