summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-03 10:09:19 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-11-03 10:09:19 +0000
commita3b58a99a41a86ac422b863ee2844e354b2915f3 (patch)
tree0210a526673df227e1840d616c35ff13fa5e81ca /pp_ctl.c
parent28c3722c366b749ca5cccbb25c2ed5b72672ecd2 (diff)
downloadperl-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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 7b91e86c23..7a8da0d5ce 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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;