It seems like you might be looking to change Perl's default @INC,
which would take a re-compile.
However, if you're looking for an answer like presented
above, you might want to try:
use lib qw(/path/to/add /another/path/to/add);
Using lib is a more simple way of doing what has been suggested by those who have posted before me.
It hides the details of the BEGIN block, but it is essentially the same.
Hope this helps!
--jwest
-><- -><- -><- -><- -><-
All things are Perfect
To every last Flaw
And bound in accord
With Eris's Law
- HBT; The Book of Advice, 1:7
| [reply] [d/l] |
Use the environment variable PERL5LIB, usually like this
% PERL5LIB=$HOME/perllib; export PERL5LIB
Watch out though, this does not work if you are running under perl -T, in that case you have to use lib explicitly as suggested elsewhere in this thread.
-- Hofmator
| [reply] [d/l] |
One method of modifying @INC is as follows:
BEGIN {
unshift(@INC, 'the/path/you/want');
}
It is important that you do it within a BEGIN block because all use statements are processed before the rest of the program; An exception to this are BEGIN blocks. | [reply] [d/l] [select] |
Will this method perserve the new @INC after the program ends ?
| [reply] |
No. It will change it for just the run of the program.
| [reply] |
Ummm... Are you calling any kind of Module in your script?? If so... Is that module installed?? | [reply] |
Multiple Scripts with Multiple modules
| [reply] |