@INC is not what I expect

Discussion in 'Perl' started by niz, Jul 23, 2003.

  1. niz

    niz Guest

    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, Jul 23, 2003
    #1
    1. Advertising

  2. 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"
     
    Andre Bonhote, Jul 23, 2003
    #2
    1. Advertising

  3. 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.
     
    Simon Andrews, Jul 23, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Strandgaard

    how to expect eof with expect+pty

    Simon Strandgaard, Dec 20, 2006, in forum: Ruby
    Replies:
    4
    Views:
    364
    Simon Strandgaard
    Dec 20, 2006
  2. Jennifer
    Replies:
    1
    Views:
    171
    Tad McClellan
    Jun 24, 2003
  3. niz

    @INC is not what I expect

    niz, Jul 23, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    85
    Simon Andrews
    Jul 23, 2003
  4. Replies:
    3
    Views:
    1,694
  5. Phil
    Replies:
    0
    Views:
    171
Loading...

Share This Page