Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CPAN installing modules into perl5 instead of site_perl

Tags:

perl

cpan

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 ?

like image 982
Ian Avatar asked Feb 11 '23 01:02

Ian


1 Answers

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';
like image 177
ikegami Avatar answered Mar 05 '23 05:03

ikegami