How2 prevent perl's searching "std directories"?

K

kj

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
 
B

Ben Morrow

kj said:
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
 
K

kj

Is there a way to prevent perl from searching "standard" directories
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
 
K

kj

In said:
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
 
B

Bart Lateur

kj said:
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
 

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,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top