Subject: | install_sets function may return invalid result |
Hello,
I am using user defined cpan installation:
cpan[3]> o conf mbuild_arg
mbuild_arg [--installdirs=site --install_base=/home/tvv/perl --install_path bindoc=/home/tvv/perl/man/man1 --install_path libdoc=/home/tvv/perl/man/man3]
cpan[4]> o conf makepl_arg
makepl_arg [INSTALLDIRS=site INSTALL_BASE=/home/tvv/perl INSTALLMAN1DIR=/home/tvv/perl/man/man1 INSTALLMAN3DIR=/home/tvv/perl/man/man3]
For instance, I tried to install Test::Exception and got error:
CPAN.pm: Building A/AD/ADIE/Test-Exception-0.32.tar.gz
Building Test-Exception
Can't use an undefined value as a HASH reference at /home/tvv/perl/lib/perl5/Module/Build/Base.pm line 3170.
ADIE/Test-Exception-0.32.tar.gz
./Build --installdirs=site --install_base=/home/tvv/perl --install_path bindoc=/home/tvv/perl/man/man1 --install_path libdoc=/home/tvv/perl/man/man
3 --installdirs=site --install_base=/home/tvv/perl --install_path bindoc=/home/tvv/perl/man/man1 --install_path libdoc=/home/tvv/perl/man/man3 -- NOT
OK
Running Build test
Can't test without successful make
Running Build install
Make had returned bad status, install seems impossible
Failed during this command:
ADIE/Test-Exception-0.32.tar.gz : make NO
The 3170 line points to _is_default_installable() function and I found out that $self->installdirs() in my case returns array reference with values ['site', 'site'].
In that case function install_sets() on line = 5043 will do:
return $map->{$dirs};
But, $dirs is an array reference! I've attached a small patch, but I am not sure that is everything is correct.
Perl: 5.16.3
OS: Fedora 19 x86_64
Thank you.
Subject: | Module-Build_install_sets-01.diff |
--- /home/tvv/perl/lib/perl5/Module/Build/Base.pm.orig 2014-07-26 12:34:51.000000000 +0400
+++ /home/tvv/perl/lib/perl5/Module/Build/Base.pm 2014-07-26 12:38:51.665881182 +0400
@@ -5057,7 +5057,11 @@
return $map->{$dirs}{$key};
}
elsif ( defined $dirs ) {
- return $map->{$dirs};
+ if (ref $dirs eq 'ARRAY') {
+ return $map->{$dirs->[0]};
+ } else {
+ return $map->{$dirs};
+ }
}
else {
croak "Can't determine installdirs for install_sets()";