Reputation: 3034
Before I use cpanm
to install some Perl modules on a "new" (to me) system, I would like to know where they will get installed by default.
I don't see any kind of a dry-run option, which is what I'd hoped for.
perl -V
includes this %ENV and @INC info:
%ENV:
PERL5LIB="/home/randall/perl5/lib/perl5"
PERL_HOMEDIR="1"
PERL_LOCAL_LIB_ROOT="/home/randall/perl5"
PERL_MB_OPT="--install_base /home/randall/perl5"
PERL_MM_OPT="INSTALL_BASE=/home/randall/perl5"
@INC:
/home/randall/perl5/lib/perl5
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
Does that define the behavior, or are there other considerations? Specifically, the documentation for cpanm includes:
-l, --local-lib Sets the local::lib compatible path to install modules to. You don't need to set this if you already configure the shell environment variables using local::lib, but this can be used to override that as well.
But it does not indicate which environment variables are significant.
Upvotes: 7
Views: 10343
Reputation: 507
This can be of help: https://metacpan.org/pod/App::cpanminus#Where-does-this-install-modules-to?-Do-I-need-root-access?
Where does this install modules to? Do I need root access?
It installs to wherever ExtUtils::MakeMaker and Module::Build are configured to (via
PERL_MM_OPT
andPERL_MB_OPT
).By default, it installs to the site_perl directory that belongs to your perl. You can see the locations for that by running
perl -V
and it will be likely something under/opt/local/perl/...
if you're using system perl, or under your home directory if you have built perl yourself using perlbrew or plenv.If you've already configured local::lib on your shell, cpanm respects that settings and modules will be installed to your local perl5 directory.
At a boot time, cpanminus checks whether you have already configured local::lib, or have a permission to install modules to the site_perl directory. If neither, i.e. you're using system perl and do not run cpanm as a root, it automatically sets up local::lib compatible installation path in a
perl5
directory under your home directory.
Upvotes: 8