From: Rafael Garcia-Suarez Date: Wed, 19 Sep 2001 22:47:14 +0000 (+0200) Subject: proposal : put the @INC-hooks directly in %INC X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89ccab8c20e3e6e4f26601a6cd281f4a12410607;p=p5sagit%2Fp5-mst-13.2.git proposal : put the @INC-hooks directly in %INC Message-ID: <20010919224714.A6382@rafael> p4raw-id: //depot/perl@12162 --- diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 99d2960..e61e8ed 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -1156,10 +1156,9 @@ value is the location of the file found. The C operator uses this hash to determine whether a particular file has already been included. -If the file was loaded via a hook (see L for a -description of these hooks), a fake filename is inserted into %INC. It -looks like F, where the hexadecimal number -corresponds to the reference that was put in @INC. +If the file was loaded via a hook (e.g. a subroutine reference, see +L for a description of these hooks), this hook is +inserted into %INC in place of a filename. =item %ENV diff --git a/pp_ctl.c b/pp_ctl.c index 5d2d10f..d488b7c 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;