@INC Perl- Can't locate Class/CSV.pm in @INC
Solution 1
Assuming that Class::CSV
is installed on your system, your library search path is incomplete. (Your error message lists C:/Per/site/lib
as a search lib, which looks like a typo for C:/Perl/site/lib
, which you might want to look into.)
You need to locate the correct CSV.pm
file where the library is located. For example, if it's found in:
C:/Perl/lib/foo/Class/CSV.pm
Then you have one of the following options.
Modify the environment for Perl or the invocation so that this is set (assuming my Windows skill haven't expired completely, someone feel free to edit and correct if I get the syntax wrong):
PERL5LIB=%PERL5LIB%;C:/Perl/lib/foo
You can use the
-I
option to perl to add the path:perl -IC:/Perl/lib/foo my-app.pl
You can use the
use lib
command in the program itself to add the search path:use lib 'C:/Perl/lib/foo'; use Class::CSV; # etc.
Solution 2
You probably don't have these modules installed.
run this in your shell
perl -MCPAN -e shell
then run
install Class::CSV
I'm assuming that you found these classes on CPAN
QuinsUK
Updated on November 22, 2022Comments
-
QuinsUK over 1 year
I am currently trying to create/generate a CSV file using one of three classes:
use Class::CSV; use Text::CSV; use Text::CSV_XS;
Though when I try and run it, to check my code I come up with the same error message:
Can't locate Class/CSV.pm in @INC (@INC contains: C:/Per/site/lib C:/Perl/lib .) at C:\Users\<DIRECTORY> - <DIRECTORY>.file.pl line1
I have tried searching for the files though I haven't had any luck. Has anyone else come up against this problem? I have looking in the Directory and the CSV.pm file does exists.
-
QuinsUK over 11 yearsYes I did get these classes on CPAN, all the others worked, apart from this classes for some reason.
-
QuinsUK over 11 yearsDo you then run all your Perl scripts through this now?? What does this do??
-
John Corbett over 11 yearsare you sure it installed correctly? Try installing again to see if CPAN recognizes the modules as installed.
-
QuinsUK over 11 yearsInstalling the @INC environment again or just unzipping the class files again?
-
John Corbett over 11 yearstry installing the CPAN module again, and see if it tries to. If it tries to install the module again, it didn't install correctly the first time, otherwise it will tell the that it's installed properly and give you a version number. I'll bet that it didn't install properly because you can't find the files and you're getting an @INC error.
-
QuinsUK over 11 yearsThank you, I am new to Perl, so I am trying to figure all this out.
-
zostay over 11 yearsNo problem. I like to help. Unfortunately, not all the Perl hackers out there (or even on this site) have the patience to deal with someone trying to figure it out. I commend you to Perl and staying the course. I think you'll find it rewarding to use. Cheers.