Friday, June 26, 2009

Perl Errors

Missing Module in array @INC

(use perl -e 'print join("\n", @INC);' to print the list of directories in @INC)

Errors like: Can't locate TimeDateNum.pm in @INC (@INC contains: /usr/local/lib/perl5/5.8.5/i86pc-solaris /usr/local/lib/perl5/5.8.5 /usr/local/lib/perl5/site_perl/5.8.5/i86pc-solaris /usr/local/lib/perl5/site_perl/5.8.5 /usr/local/lib/perl5/site_perl .) at ./test.pl line 5.

Solution:

We need to provide the missing module to perl. It can be done in the following ways.
1. Specify it in the PERL5LIB environment variable
export PERL5LIB="path of required module"

2. Use the -I option to specify the additional directories where it should search for modules while invoking perl.
perl -I "path of required module" script.pl

3. Modify your Perl program to find the module by adding the below line at the top of your program.

use lib "path of required module";

Perl adds this directory to it's @INC search list.


No comments:

Post a Comment