summaryrefslogtreecommitdiff
path: root/dist/ExtUtils-Install/t
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-11 15:05:58 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-11 15:05:58 +0100
commitfc5e5837c991d3d3224259ff5c1d728d4e0636e2 (patch)
tree438e1ae38ef95cb035498523d38cda85d46e8e20 /dist/ExtUtils-Install/t
parent794ae82d17ef6f7770c42b070af5c40bc4bf19cb (diff)
downloadperl-fc5e5837c991d3d3224259ff5c1d728d4e0636e2.tar.gz
MakeMaker::Test::Utils::perl_lib now copes with relative paths for core testing.
In the core, @INC already contains the moral equivalent of blib/lib. However, it's a relative path (by default), so make it absolute. It's easier to KISS if this is done *before* any change of directory, so document this, and change the non-core case to add the absolute path of 'blib/lib' to @INC, rather than the absolute path of '../blib/lib'.
Diffstat (limited to 'dist/ExtUtils-Install/t')
-rw-r--r--dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm27
1 files changed, 18 insertions, 9 deletions
diff --git a/dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm b/dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm
index 7e5d5fc6cd..907ca9b07f 100644
--- a/dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm
+++ b/dist/ExtUtils-Install/t/lib/MakeMaker/Test/Utils.pm
@@ -135,21 +135,30 @@ sub which_perl {
perl_lib;
Sets up environment variables so perl can find its libraries.
+Run this before changing directories.
=cut
my $old5lib = $ENV{PERL5LIB};
my $had5lib = exists $ENV{PERL5LIB};
sub perl_lib {
- # perl-src/t/
- my $lib = $ENV{PERL_CORE} ? qq{../lib}
- # ExtUtils-MakeMaker/t/
- : qq{../blib/lib};
- $lib = File::Spec->rel2abs($lib);
- my @libs = ($lib);
- push @libs, $ENV{PERL5LIB} if exists $ENV{PERL5LIB};
- $ENV{PERL5LIB} = join($Config{path_sep}, @libs);
- unshift @INC, $lib;
+ if ($ENV{PERL_CORE}) {
+ # Whilst we'll be running in perl-src/cpan/$distname/t/
+ # instead of blib, our code will be copied with all the other code to
+ # the top-level library.
+ # $ENV{PERL5LIB} will be set with this, but (by default) it's a relative
+ # path.
+ $ENV{PERL5LIB} = join $Config{path_sep}, map {
+ File::Spec->rel2abs($_) } split $Config{path_sep}, $ENV{PERL5LIB};
+ @INC = map { File::Spec->rel2abs($_) } @INC;
+ } else {
+ my $lib = 'blib/lib';
+ $lib = File::Spec->rel2abs($lib);
+ my @libs = ($lib);
+ push @libs, $ENV{PERL5LIB} if exists $ENV{PERL5LIB};
+ $ENV{PERL5LIB} = join($Config{path_sep}, @libs);
+ unshift @INC, $lib;
+ }
}
END {