Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell CPAN.pm to install all modules in a specific directory?

Tags:

perl

cpan

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?

like image 234
Chas. Owens Avatar asked Apr 24 '09 16:04

Chas. Owens


People also ask

Where do CPAN modules get installed?

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 ).

How do I install perl modules in CPAN?

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.

What is CPAN command?

"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".


1 Answers

Install local::lib. It will handle all the configuration for you.

like image 186
jrockway Avatar answered Nov 05 '22 07:11

jrockway