4

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?

toolic
  • 57,801
  • 17
  • 75
  • 117
chuck taylor
  • 2,476
  • 5
  • 29
  • 46
  • 1
    Sounds like your cpanplus was misconfigured, so it installed libraries in the wrong place. – Ether Jul 21 '10 at 21:21
  • 7
    Answerers on crack again today; the question clearly asks about [Error](http://p3rl.org/Error) and everyone talks about the irrelevant [CPANPLUS::Error](http://p3rl.org/CPANPLUS::Error). chuck, you just have to install this missing module before you can use it. See http://stackoverflow.com/questions/65865/whats-the-easiest-way-to-install-a-missing-perl-module – daxim Jul 22 '10 at 07:55

5 Answers5

4

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.

daxim
  • 39,270
  • 4
  • 65
  • 132
Toto
  • 89,455
  • 62
  • 89
  • 125
1

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.

Alexandr Ciornii
  • 7,346
  • 1
  • 25
  • 29
  • Note, this only works with ActivePerl, NOT for Strawberry Perl. On Strawberry Perl you need to use `cpan`. – Mithaldu Sep 12 '17 at 10:05
0

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.

fholzer
  • 340
  • 3
  • 13
0

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

sudo dnf install perl-Error
qwertzguy
  • 15,699
  • 9
  • 63
  • 66
-2

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

xenoterracide
  • 16,274
  • 24
  • 118
  • 243