Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - @INC is not what I expect

 
Thread Tools Search this Thread
Old 07-23-2003, 09:38 AM   #1
Default @INC is not what I expect


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?


niz
  Reply With Quote
Old 07-23-2003, 09:45 AM   #2
Andre Bonhote
 
Posts: n/a
Default Re: @INC is not what I expect

In article <>, niz wrote:
> 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é

--
Every cloud engenders not a storm.
-- William Shakespeare, "Henry VI"
  Reply With Quote
Old 07-23-2003, 09:57 AM   #3
Simon Andrews
 
Posts: n/a
Default Re: @INC is not what I expect



niz wrote:
> 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.

  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump