ronhoward
ronhoward

Reputation: 71

Cannot locate Config/General.pm Perl module in @INC?

I am running a perl script that uses Config::General. However, when I run the script, I get the error:

Can't locate Config/General.pm in @INC (you may need to install the Config::General module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2/darwin-thread-multi-2level /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at test.pl line 6.
BEGIN failed--compilation aborted at test.pl line 6.

When I try to install it myself (using 'cpanm Config::General'), I get:

Can't write to /Library/Perl/5.18 and /usr/local/bin: Installing modules to /Users/../perl5

Not sure if I should attempt to try to install as root since this is a work computer? Any other options?

Upvotes: 1

Views: 3952

Answers (1)

gugod
gugod

Reputation: 830

Since you already use cpanm, you may try this approach:

  1. Install all modules with prefix ~/perl5
cpanm -L ~/perl5 Config::General
  1. Set @INC to includ that when running your program, for example:
perl -I ~/perl5/lib/perl5 test.pl

The path looks a bit odd, but that's because cpan distributions may contain something more than a .pm file.

Generally speaking this should work most of the time. :-)

Upvotes: 1

Related Questions