How2 prevent perl's searching "std directories"?

Discussion in 'Perl Misc' started by kj, Feb 10, 2004.

  1. kj

    kj Guest

    Is there a way to prevent perl from searching "standard" directories
    when looking for library files? Is there a way to set (as opposed
    to append to) @INC on the command line when invoking perl?

    Thanks!

    kj
     
    kj, Feb 10, 2004
    #1
    1. Advertising

  2. kj

    Ben Morrow Guest

    kj <> wrote:
    >
    > Is there a way to prevent perl from searching "standard" directories
    > when looking for library files? Is there a way to set (as opposed
    > to append to) @INC on the command line when invoking perl?


    perl -e'BEGIN { @INC = "/my/inc" }'

    If you need to do this when invoking a script, it'd probably be easier
    to write a little lib::eek:nly module

    package lib::eek:nly;

    sub import {
    @INC = @_;
    }

    1;

    and use

    perl -Mlib::eek:nly=/my/inc,/my/other/inc script

    rather than

    perl -e'BEGIN { @INC = qw|/my/inc /my/other/inc| }' -e'do "script"'

    Ben

    --
    Joy and Woe are woven fine,
    A Clothing for the Soul divine William Blake
    Under every grief and pine 'Auguries of Innocence'
    Runs a joy with silken twine.
     
    Ben Morrow, Feb 10, 2004
    #2
    1. Advertising

  3. kj

    kj Guest

    >> Is there a way to prevent perl from searching "standard" directories
    >> when looking for library files? Is there a way to set (as opposed
    >> to append to) @INC on the command line when invoking perl?


    I neglectd to mention that I want to control the searchpath for
    the perl debugger. I'm trying to debug a perl installation, but
    the debugger is crashing on me because it is reading the previously
    installed (and incompatible) site libraries.

    Thanks,

    kj
     
    kj, Feb 10, 2004
    #3
  4. kj

    kj Guest

    In <c0aqp7$9u4$> Ben Morrow <> writes:

    > perl -Mlib::eek:nly=/my/inc,/my/other/inc script


    I tried

    ~/build/perl-5.8.2$ ./perl -Mlib::eek:nly=lib -d misctmp003
    ../perl: relocation error: /usr/lib/perl/5.8.2/auto/IO/IO.so: undefined symbol: Perl_Tstack_sp_ptr

    ....so perl is still looking at the standard directories.

    kj
     
    kj, Feb 10, 2004
    #4
  5. kj

    kj Guest

    In <c0ar8q$p94$> kj <> writes:

    >In <c0aqp7$9u4$> Ben Morrow <> writes:


    >> perl -Mlib::eek:nly=/my/inc,/my/other/inc script


    >I tried


    >~/build/perl-5.8.2$ ./perl -Mlib::eek:nly=lib -d misctmp003
    >./perl: relocation error: /usr/lib/perl/5.8.2/auto/IO/IO.so: undefined symbol: Perl_Tstack_sp_ptr


    >...so perl is still looking at the standard directories.


    OK, it worked. I needed to add -Ilib to the command line.

    Cool! Thanks.

    kj
     
    kj, Feb 10, 2004
    #5
  6. kj

    Bart Lateur Guest

    kj wrote:

    >Is there a way to prevent perl from searching "standard" directories
    >when looking for library files? Is there a way to set (as opposed
    >to append to) @INC on the command line when invoking perl?


    Look into the lib pragma. Usually you use it as

    use lib '/path/to/lib';

    in a program, or as

    -Mlib=/path/to/lib

    on the command line, but you can do

    no lib '/path/to/remove';

    as well. For the command line, insert a "-" right after the "M":

    -M-lib=/path/to/remove,/another/path/to/remove

    --
    Bart.
     
    Bart Lateur, Feb 11, 2004
    #6
    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. clintonG
    Replies:
    1
    Views:
    315
    Karl Seguin
    Oct 26, 2004
  2. clintonG

    How2 Use Expression Syntax in HTML

    clintonG, Aug 25, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    477
    clintonG
    Aug 26, 2005
  3. John McGaw
    Replies:
    31
    Views:
    1,000
    Toby A Inkster
    Jan 12, 2004
  4. Robert Kattke
    Replies:
    0
    Views:
    439
    Robert Kattke
    Dec 31, 2003
  5. tesis
    Replies:
    2
    Views:
    1,177
    Mark Fitzpatrick
    Oct 12, 2008
Loading...

Share This Page