diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-11-03 10:09:19 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-11-03 10:09:19 +0000 |
commit | a3b58a99a41a86ac422b863ee2844e354b2915f3 (patch) | |
tree | 0210a526673df227e1840d616c35ff13fa5e81ca /pp_ctl.c | |
parent | 28c3722c366b749ca5cccbb25c2ed5b72672ecd2 (diff) | |
download | perl-a3b58a99a41a86ac422b863ee2844e354b2915f3.tar.gz |
When code is loaded through an @INC-hook, and when this hook
has set a filename entry in %INC, make sure __FILE__ is set
for this code accordingly to the contents of that %INC entry.
p4raw-id: //depot/perl@29197
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -3166,6 +3166,7 @@ PP(pp_require) if (SvROK(dirsv)) { int count; + SV **svp; SV *loader = dirsv; if (SvTYPE(SvRV(loader)) == SVt_PVAV @@ -3193,6 +3194,11 @@ PP(pp_require) count = call_sv(loader, G_ARRAY); SPAGAIN; + /* Adjust file name if the hook has set an %INC entry */ + svp = hv_fetch(GvHVn(PL_incgv), name, len, 0); + if (svp) + tryname = SvPVX_const(*svp); + if (count > 0) { int i = 0; SV *arg; |