Futuregeek
Futuregeek

Reputation: 1980

Perl modules not taken from the custom lib path

I have installed Perl into a custom directory ang set export_path. now which perl shows the custom path and Perl -V shows the details of custom path and @INC shows like custompath/lib/5.8.9 etc.

The issue is, when I run the perl script that contain perl modules like DBI, I get error like

> Can't locate DBI.pm in @INC (@INC contains:
> /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi
> /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl
> /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi
> /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl
> /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .)

Why it is not showing the @INC as custom path and why it is throwing error?

Upvotes: 0

Views: 448

Answers (1)

ikegami
ikegami

Reputation: 385764

It looks like you're using one build of Perl for perl -V, and a different build to actually execute your script.

perl -V (and perl script.pl) is using the first perl in your PATH, while script.pl uses the perl indicated on the script's shebang (#!) line.

It's probably simply a question of adjusting the shebang line of your script.

Upvotes: 2

Related Questions