3

I have tried to setup cpan on my ubuntu 12.04 using:

sudo cpan

and it created a folder perl5 in my $HOME folder. I would like to use a different directory such as $HOME/.perl5 or somewhere in /usr/local/lib for the modules. Is it possible?

none
  • 287
  • 1
  • 4
  • 13
  • When running cpan for the first time, it appended the path settings to my `.bashrc` file as environment variables. – mt025 Feb 03 '23 at 04:01

1 Answers1

6

The destination to which CPAN installs modules can be changed by setting its options (run o conf in the CPAN shell):

makepl_arg         [INSTALL_BASE=/home/gokcehan/.perl5]
mbuildpl_arg       [--install_base=/home/gokcehan/.perl5]

To let CPAN and Perl search for modules in the given path, set the environment variable PERL5LIB:

PERL5LIB=/home/gokcehan/.perl5:/home/gokcehan/.perl5/$arch

where $arch is the output of

use Config;
print Config->{archname};
choroba
  • 9,273
  • 1
  • 30
  • 42