@INC is not what I expect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • niz

    @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?
  • Andre Bonhote

    #2
    Re: @INC is not what I expect

    In article <fc69f921.03072 30038.6700a29e@ posting.google. com>, niz wrote:[color=blue]
    > I have this perl script running on solaris in korn:[/color]

    I don't think perl cares about your shell environment.
    [color=blue]
    > $ cat scriptb.sh
    > #!/usr/bin/perl
    > use strict;
    > use DBI;
    >
    > these are my included library directories:
    >
    > $ perl -e "print join(\"\n\", @INC);"[/color]

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

    [snip]
    [color=blue]
    > /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[/color]

    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]
    [color=blue]
    > any explanations? how is it getting that strange @INC list?[/color]

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

    André

    --
    Every cloud engenders not a storm.
    -- William Shakespeare, "Henry VI"

    Comment

    • Simon Andrews

      #3
      Re: @INC is not what I expect



      niz wrote:[color=blue]
      > I have this perl script running on solaris in korn:
      >
      > $ cat scriptb.sh
      > #!/usr/bin/perl[/color]
      [color=blue]
      > $ perl -e "print join(\"\n\", @INC);"[/color]
      [color=blue]
      > 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?[/color]

      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.

      Comment

      Working...