2

I try to install/update Perl module with cpanm. But, it failed for every modules.

for example:

cpanm Config::General
--> Working on Config::General
Fetching http://www.cpan.org/authors/id/T/TL/TLINDEN/Config-General-2.56.tar.gz ... OK
Configuring Config-General-2.56 ... OK
Building and testing Config-General-2.56 ... OK
Successfully installed Config-General-2.56 (upgraded from 2.52)
1 distribution installed

So, i expect that version of Config::General is now 2.56, but... :

perl -e 'use Config::General 2.56'
Config::General version 2.56 required--this is only version 2.52 at -e line 1.

I try the same logged in superU but same problem... But now, i have Perl lib in

~/perl5/lib/perl5/ and /usr/lib/perl/5.18/

How can i properly update Perl modules with cpanm?


Some information about my install:

$ perl -E'
   say "$_=$ENV{$_}" for qw( PERL_MM_OPT PERL_MB_OPT PERL5LIB );
   say "--";
   say for @INC;
'
PERL_MM_OPT=INSTALL_BASE=/home/hacklionex/perl5
PERL_MB_OPT=--install_base "/home/hacklionex/perl5"
PERL5LIB=
--
/etc/perl
/usr/local/lib/perl/5.18.2
/usr/local/share/perl/5.18.2
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.18
/usr/share/perl/5.18
/usr/local/lib/site_perl
.
ikegami
  • 367,544
  • 15
  • 269
  • 518

1 Answers1

5

Your are instructing the module installers to install modules in /home/hacklionex/perl5 (via PERL_MM_OPT and PERL_MB_OPT), but you don't tell Perl to look for modules there (it's not in @INC). Add the following to your login script:

export PERL5LIB=/home/hacklionex/perl5/lib/perl5

Or add the following to your script:

use lib '/home/hacklionex/perl5/lib/perl5';
ikegami
  • 367,544
  • 15
  • 269
  • 518
  • it works now, thanks a lot. Some modules Failed to update because of permission access. I have one more question: how do I know where cpanm install the module, in the case where I am logged in SuperU or not? – Rémi Maglione May 15 '15 at 19:10
  • 2
    `cpanm` doens't install any modules. It runs the distro's `Makefile.PL` or `Build.PL`. `Makefile.PL` is expected to use ExtUtils::MakeMaker to install the distro, and `Build.PL` is expected to use Module::Build. Both take options from the command line which can also be specified in environment variables (`PERL_MM_OPT` and `PERL_MB_OPT` respectively). – ikegami May 15 '15 at 19:12