I have set
makepl_arg [INSTALLDIRS=site PREFIX=~/perl]
mbuildpl_arg [--install_base ~/perl]
in the CPAN.pm configuration. I had hoped that this would cause modules to get installed in the same place, but I still have to set multiple paths in PERL5LIB:
export PERL5LIB=~/perl/share/perl/5.10.0:~/perl/lib/perl5/:~/perl/lib/perl/5.10.0
This has been the case for a long time and I have just lived with it, but I was wondering if anyone knew how to get CPAN.pm to put all modules in the same directory?
CPAN doesn't actually install files. It runs the install script embedded in each distribution, which then performs the actual install. For distributions using ExtUtils::MakeMaker, the defaults are documented here: https://metacpan.org/pod/ExtUtils::MakeMaker#make-install (and the default value of INSTALLDIRS is site ).
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.
"cpan" splits this variable on whitespace and prepends that list to @ARGV before it processes the command-line arguments. For instance, if you always want to use "local:lib", you can set "CPAN_OPTS" to "-I".
Install local::lib. It will handle all the configuration for you.
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