Disabling Local::Lib for CPAN


It's all very well when things are automatic, but when you absent-mindedly click OK too many times in a row, without really reading all those prompts... you can get yourself into rather a predicament from which web searches can hardly get you out.

I happily took all the defaults for a new installation of CPAN on Fedora 17 and discovered it had installed something called "Local::Lib" -- quite a cool thing, really, as it lets users install their own versions of Perl modules without needing admin privileges.

Except I did not want the root user's CPAN to have that! It turns out to be quite simple to disable. You might be able to use one command (as root):

# <span style="text-decoration: underline;">unset PERL5LIB</span>

or, more permanently, comment out the "set" c ommands in your /root/.bashrc − there may be more than one. It might even look something like this (without the # originally):

#export PERL_LOCAL_LIB_ROOT="/root/perl5";
#export PERL_MB_OPT="--install_base /root/perl5";
#export PERL_MM_OPT="INSTALL_BASE=/root/perl5";
#export PERL5LIB="/root/perl5/lib/perl5/x86_64-linux-thread-multi:/root/perl5/lib/perl5";
#export PATH="/root/perl5/bin:$PATH";

Comment them all, as shown above. Then re-login as root.