4
votes

I'm trying to do a temporary install of some cpan modules into a custom folder (/tmp/perl). So I have amending the build install base with...

o conf mbuildpl_arg "--install_base /tmp/perl"
o conf makepl_arg "INSTALL_BASE=/tmp/perl"

Which works fine, the modules get installed into that directory now. I also set PERL5LIB with

  PERL5LIB=/tmp/perl/lib/5.14.2/:/tmp/perl/lib/site_perl/:/opt/perl/lib/5.14.2/:/opt/perl/lib/site_perl/:

Note, this is all just temporary, on a virtual server which will be destroyed.

I note that, previously it would install modules into buildpath/lib/5.14.2 or buildpath/lib/site_perl

However now, its installing modules into buildpath/lib/perl5

My understanding was that core perl modules ended up in buildpath/lib/5.14.2 and non-core modules ended up in buildpath/lib/site_perl.

As this is installing into buildpath/lib/perl5, what decides to install into the perl5 directory as opposed to 5.14.2 or site_perl ?

2
Just adding a comment that I've since found info on search.cpan.org/~bingos/ExtUtils-MakeMaker-7.04/lib/ExtUtils/… useful as well - Ian

2 Answers

8
votes

Unless you override ExtUtils::MakeMaker and Module::Build through environment variables (i.e. values in PERL_MM_OPT and PERL_MB_OPT) or command line arguments (e.g. values in cpan's mbuildpl_arg and makepl_arg), locations hardcoded into Perl when it was built will be used. The following command will show you those locations (for .pm and associated files):

perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
  • installprivlib contains the "pure Perl" modules that came with Perl.
  • installarchlib is the same for modules with arch- or build-dependent components.
  • installvendorlib contains the "pure Perl" modules installed by your distro.
  • installvendorarch is the same for modules with arch- or build-dependent components.
  • installsitelib contains the "pure Perl" modules installed by you.
  • installsitearch is the same for modules with arch- or build-dependent components.

Example runs:

$ perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
installprivlib='/usr/share/perl/5.14';
installarchlib='/usr/lib/perl/5.14';
installvendorlib='/usr/share/perl5';
installvendorarch='/usr/lib/perl5';
installsitelib='/usr/local/share/perl/5.14.2';
installsitearch='/usr/local/lib/perl/5.14.2';

$ perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
installprivlib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/5.20.1';
installarchlib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/5.20.1/x86_64-linux-thread-multi';
installvendorlib='';
installvendorarch='';
installsitelib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/site_perl/5.20.1';
installsitearch='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/site_perl/5.20.1/x86_64-linux-thread-multi';

>perl -V:"install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)"
installprivlib='C:\progs\sp5280-x64\perl\lib';
installarchlib='C:\progs\sp5280-x64\perl\lib';
installvendorlib='C:\progs\sp5280-x64\perl\vendor\lib';
installvendorarch='C:\progs\sp5280-x64\perl\vendor\lib';
installsitelib='C:\progs\sp5280-x64\perl\site\lib';
installsitearch='C:\progs\sp5280-x64\perl\site\lib';
0
votes

There is no answer posted here. I have the same problem. cpan and cpanm installs are going into (using X to shorten paths):

/X/lib/perl5

but that path is not in @INC:

perl -V

  @INC:
/X/lib/perl5/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/5.22.0
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/site_perl
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/5.22.0

PERL_MM_OPT and PERL_MB_OPT have the following values, which do not appear to be incorrect:

PERL_MB_OPT="--install_base /X"
PERL_MM_OPT="INSTALL_BASE=/X"

I have Perl installed within a conda environment. I suspect the problem is that CPAN and CPANM are making improper assumptions about the subdirectory structure underneath the paths contained in PERL_MB_OPT and PERL_MM_OPT.