Module Installation errors when trying to use local::lib and CPAN

930 Views Asked by At

I am trying to use local::lib as I don’t have admin rights on the system and I want to download and install a local library. I ran following:

perl Makefile.PL --bootstrap

make test && make install

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

After this I tried to download the Module via cpan by running perl -MCPAN -e shell install netAddr::IP but when i am running my program it's giving an error:

Can't locate NetAddr/IP.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at agha.pl line 8.
BEGIN failed--compilation aborted at agha.pl line 8.

I took that to mean the module is not installed... So I again tried to go through CPAN, but now it's giving an error (this is in Linux):

-bash-3.2$ perl -MCPAN -e shell

There seems to be running another CPAN process (pid 15611).  Contacting...
Other job is running.
You may want to kill it and delete the lockfile, maybe. On UNIX try:
kill 15611
rm /homes/ar312/.cpan/.lock
2

There are 2 best solutions below

0
On BEST ANSWER

From the local::lib documentation:

After writing your shell configuration file, be sure to re-read it to get the changed settings into your current shell's environment.

You forgot to do so.

1
On

In all seriousness, save yourself a ton of time and trouble by installing perlbrew.

perlbrew is a tool to manage multiple perl installations in your $HOME directory. They are completely isolated perl universes. This approach has many benefits:

  • No need to run sudo to install CPAN modules, any more.
  • Try the monthly released new perls.
  • Learn new language features.
  • Test your production code against different perl versions.
  • Leave vendor perl (the one that comes with OS) alone