chuck taylor
chuck taylor

Reputation: 2516

Why do I get this module error: "Can't locate Error.pm in @INC"?

I tried running:

perl -e "use Error;" 

from cmd in windows 7. (active perl 5.12 installed on system) and I am getting the error

Can't locate Error.pm in @INC (@INC contains: C:/Perl64/site/lib C:/Perl64/lib )

I manually searched and found Error.pm in C:/Perl64/lib/CPANPLUS.

Does anyone have an idea what could be going on here?

Upvotes: 4

Views: 21593

Answers (5)

qwertzguy
qwertzguy

Reputation: 17677

On Centos 8, you can installing perl-Error to get this module:

sudo dnf install perl-Error

Upvotes: 0

fholzer
fholzer

Reputation: 340

I'm on CentOS 7.3, and I have git-1.8.3.1-23 and perl-Error-0.17014-1 rpm packages installed and still got this error. I didn't want to mess with installing perl modules via CPAN. I figured out the path where perl-Error is installed (rpm -ql perl-Error) and am now running git commands like so:

PERL5LIB="/usr/lib/perl5/vendor_perl/5.8.8" git add -p someFile.sh

This works fine for me. Note that the path may be different for you.

Upvotes: 0

Alexandr Ciornii
Alexandr Ciornii

Reputation: 7394

lib/CPANPLUS/Error.pm is a core "CPANPLUS::Error" module. It is used by CPANPLUS. If you want to use non-core "Error" module, you need to install it. Do "ppm install Error". Also, you can use similar modules Try::Tiny and TryCatch. They are non-core too, so you also would need to install them.

Upvotes: 1

Toto
Toto

Reputation: 91373

You have to install the module Error that can be found on CPAN. But be aware of this warning:

Using the "Error" module is no longer recommended due to the black-magical nature of its syntactic sugar, which often tends to break. Its maintainers have stopped actively writing code that uses it, and discourage people from doing so. See the "SEE ALSO" section below for better recommendations.

Upvotes: 4

xenoterracide
xenoterracide

Reputation: 16837

you could set PERL5LIB to prepend a directory to @INC

PERL5LIB="C:/Perl64/lib/CPANPLUS"

I forget how to set env variables permanently in windows (or if this is even the right syntax for the shell.)

also to see your @INC perl -V

Upvotes: -2

Related Questions