summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorRenee Baecker <renee.baecker@smart-websolutions.de>2008-12-26 00:15:25 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-12-26 00:15:25 +0100
commitccb8f6a64f3dd06b4360bc27c194b28e6766a6ad (patch)
tree9e08c17ffef10250fc4538f5002730c529c1d893 /perl.c
parent0147cd53faa57ffcd05cb0455b952fbfbe63b0b2 (diff)
downloadperl-ccb8f6a64f3dd06b4360bc27c194b28e6766a6ad.tar.gz
[perl #6665] Different behavior using the -Idir option on the command line and inside a perl script
Adds the -Idir at the beginning of @INC. (Plus a test by rgs -- check that -I does not add directories at the end of the @INC array anymore)
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/perl.c b/perl.c
index 021f35d327..deb9d383b2 100644
--- a/perl.c
+++ b/perl.c
@@ -4873,7 +4873,8 @@ S_incpush_if_exists(pTHX_ SV *dir)
if (PerlLIO_stat(SvPVX_const(dir), &tmpstatbuf) >= 0 &&
S_ISDIR(tmpstatbuf.st_mode)) {
- av_push(GvAVn(PL_incgv), dir);
+ av_unshift( GvAVn( PL_incgv ), 1 );
+ av_store( GvAVn( PL_incgv ), 0, dir );
dir = newSV(0);
}
return dir;
@@ -5093,8 +5094,9 @@ S_incpush(pTHX_ const char *dir, bool addsubdirs, bool addoldvers, bool usesep,
#endif
}
- /* finally push this lib directory on the end of @INC */
- av_push(GvAVn(PL_incgv), libdir);
+ /* finally add this lib directory at the beginning of @INC */
+ av_unshift( GvAVn( PL_incgv ), 1 );
+ av_store( GvAVn( PL_incgv ), 0, libdir );
}
if (subdir) {
assert (SvREFCNT(subdir) == 1);