[CentOS] install cpan module in /usr/lib/perl5

Sun Mar 11 01:21:15 UTC 2012
Keith Keller <kkeller at wombat.san-francisco.ca.us>

On 2012-03-11, fakessh @ <fakessh at fakessh.eu> wrote:
> I encounter a problem with centos 6
> perl -MCPAN -e shell
> install MyModule
> well I installed the module
> but in the standard repertoire of the user but not in the directory of
> the perl distribution

First, you should check the various RPM repos to see if they host your
module.  It's (often) better to use a packaged version than to grab from
CPAN.  This is doubly true if the module is available from one of the
official CentOS repositories.

> how to remedy this problem
> cpan modules installed in /usr/lib/perl/

If you run cpan (note case) as root, it should install to the correct
places (assuming you trust CPAN).  If you run CPAN as a normal user it
generally won't be able to install to the system directories.  (I think
there's an option for this now, actually, so you could run everything up
to "make install" as a normal user.)

If that still doesn't work, move root's .cpan directory somewhere else
(e.g., mv ~/.cpan ~/cpan-backup) and re-run cpan from scratch.


kkeller at wombat.san-francisco.ca.us