Eli Korvigo Eli Korvigo - 1 year ago 80
Perl Question

Specify location for the local perl library

Basically, I tried this on Ubuntu and OS X:

export PERL_LOCAL_LIB_ROOT=~/.perl5
wget -O- http://cpanmin.us | perl - -l ~/.perl5 App::cpanminus local::lib
eval `perl -I ~/.perl5/lib/perl5 -Mlocal::lib`

Yet the third line insists on creating and installing all the stuff in
rather than
. How can I overcome this behaviour?

Answer Source

I don't see anything that says PERL_LOCAL_LIB_ROOT controls where local::lib installs itself. And there's absolutely no reason to believe it'll influence where the other module you are installing (App::cpanminus) will be installed.

Both App::cpanminus and local::lib use ExtUtils::MakeMaker as their installer, so the following does the trick:


One would normally configure the Module::Build installer too, but neither App::cpanminus nor local::lib have dependencies.

export PERL_MB_OPT="--install_base $HOME/.perl5"

The procedure actually documented in the docs:

wget http://search.cpan.org/CPAN/authors/id/H/HA/HAARG/local-lib-2.000019.tar.gz
tar xvzf local-lib-2.000019.tar.gz
cd local-lib-2.000019

perl Makefile.PL --bootstrap=~/.perl5
make test && make install

echo 'eval "$(perl -I$HOME/.perl5/lib/perl5 -Mlocal::lib)"' >>~/.bashrc

Then, from a fresh shell, you can install App::cpanminus.