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.
You need to use instmodsh (interactive inventory for installed Perl modules) command to find out what modules already installed on my system. instmodsh command provides an interactive shell type interface to query details of locally installed Perl modules.
You'll find them in /usr/lib/perl/{VERSION}/ as well as /usr/lib64/perl/{VERSION}/ . {VERSION} corresponding to the version of Perl. You can get it with perl --version .
To install Perl modules using CPAN, you need to use the cpan command-line utility. You can either run cpan with arguments from the command-line interface, for example, to install a module (e.g Geo::IP) use the -i flag as shown.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With