Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't locate local/lib.pm in @INC at /usr/share/perl/5.14/CPAN/FirstTime.pm

I am trying to use Perl the first time on my system which is Ubuntu 12.04. I have Perl v.5.14.2 installed.
I looked up how to install Perl modules, so I started as follows:

$ perl -MCPAN -e shell

The wizard started configuring the environment as can be seen here: http://pastebin.com/5hn8vkb5
Though, it stopped in the middle with the following error message:

...

Checksum for /home/john/.cpan/sources/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz ok
---- Unsatisfied dependencies detected during ----
----     APEIRON/local-lib-1.008009.tar.gz    ----
    ExtUtils::MakeMaker [build_requires]
Running make test
  Make had some problems, won't test
  Delayed until after prerequisites
Running make install
  Make had some problems, won't install
  Delayed until after prerequisites

Can't locate local/lib.pm in @INC (@INC contains:
    /home/john/perl5/lib/perl5
    /etc/perl
    /usr/local/lib/perl/5.14.2
    /usr/local/share/perl/5.14.2
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.14
    /usr/share/perl/5.14
    /usr/local/lib/site_perl
    /home/john/Desktop)
at /usr/share/perl/5.14/CPAN/FirstTime.pm line 1300.

What can I do to setup the Perl environment correctly on my Ubuntu installation?


After interrupting the wizard and restarting it again, there is no error message anymore. How can I start the wizard again so I can choose here:

What approach do you want? (Choose 'local::lib', 'sudo' or 'manual') [local::lib]

like image 447
JJD Avatar asked May 22 '13 22:05

JJD


People also ask

Where is @INC in Perl?

Perl interpreter is compiled with a specific @INC default value. To find out this value, run env -i perl -V command ( env -i ignores the PERL5LIB environmental variable - see #2) and in the output you will see something like this: $ env -i perl -V ... @INC: /usr/lib/perl5/site_perl/5.18.

How do I install Perl modules in CPAN?

To install Perl modules using CPAN, you need to use the cpan command-line utility. You can either run cpan with arguments from the command-line interface, for example, to install a module (e.g Geo::IP) use the -i flag as shown.

Can't locate If PM in @INC?

Solution: If you get a Perl error message like "Can't locate Foo.pm in @INC", this message means that the Perl module you're trying to include (like the module named Foo ) can't be found in Perl's include path, which is represented by the variable named @INC .


1 Answers

Several New OS's force (like Redhat 7) force to check presence of local::lib in the perl version, actually its a good thing this enables to users to use CPAN and add,experiment and enjoy new modules to be used with the perl without waiting for sitewide installation (like a root user). By default local::lib looks for $HOME/perl5 dir where the user's local or downloaded modules are located. If you see this problem then you have to do following

  1. sudo su - whatever_user_owns_perl
  2. whatever_perl_install_path/cpan install local::lib
like image 160
KeshV Avatar answered Sep 23 '22 06:09

KeshV