Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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};
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.