@INC is not what I expect

N

niz

I have this perl script running on solaris in korn:

$ cat scriptb.sh
#!/usr/bin/perl
use strict;
use DBI;

these are my included library directories:

$ perl -e "print join(\"\n\", @INC);"
/opt/arbor/arborvbs/klaunchdir/klaunch_3.1
/opt/arbor/arborvbs/scriptdir/bin
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/5.6.0/sun4-solaris
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/5.6.0
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/site_perl/5.6.0/sun4-solaris
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/site_perl/5.6.0
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/site_perl
..

but when i run the script:

$ scriptb.sh
Can't locate DBI.pm in @INC (@INC contains:
/opt/arbor/arborvbs/klaunchdir/klaunch_3.1
/opt/arbor/arborvbs/scriptdir/bin /usr/perl5/5.00503/sun4-solaris
/usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site_perl/5.005 .) at ./scriptb.sh line 3.
BEGIN failed--compilation aborted at ./scriptb.sh line 3.
$

as you can see the scripts @INC list is completely different from what
i expect, and so it can't find DBI.pm.

any explanations? how is it getting that strange @INC list?
 
A

Andre Bonhote

I have this perl script running on solaris in korn:

I don't think perl cares about your shell environment.
$ cat scriptb.sh
#!/usr/bin/perl
use strict;
use DBI;

these are my included library directories:

$ perl -e "print join(\"\n\", @INC);"

Ah! only perl. Not /usr/bin/perl ...

[snip]
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/5.6.0/sun4-solaris
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/5.6.0
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/site_perl/5.6.0/sun4-solaris
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/site_perl/5.6.0
/opt/arbor/arborvbs/arbor3p/arborperl56/lib/site_perl

This makes me assume you have two different perl interpreters installed.
Could you try the same with /usr/bin/perl instead of perl only?

[snip]
any explanations? how is it getting that strange @INC list?

That's the only idea I that comes to my mind ATM.

André
 
S

Simon Andrews

niz said:
I have this perl script running on solaris in korn:

$ cat scriptb.sh
#!/usr/bin/perl
$ perl -e "print join(\"\n\", @INC);"
the scripts @INC list is completely different from what
i expect, and so it can't find DBI.pm.

any explanations? how is it getting that strange @INC list?

You've got two versions of perl installed.

Your script is pointing at an install of perl 5.005 and your command
line is seeing perl 5.6.0. You need to update the first line of your
script to point to 5.6.0 instead.

At a command line type "which perl" to get the location of the other
perl binary, and use this location as the first line of your script,
then you should be good to go.

TTFN

Simon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top