Re: ADD PATH TO @INC
by damian1301 (Curate) on Jun 18, 2001 at 22:09 UTC
|
You push it into @INC or you use lib. This was answered not even 5 minutes ago in another question.
BEGIN{push @INC, 'C:\ads\lib';}
or
use lib 'C:\ads\lib';
UPDATE:doh
$_.=($=+(6<<1));print(chr(my$a=$_));$^H=$_+$_;$_=$^H;
print chr($_-39); # Easy but its ok.
| [reply] [d/l] [select] |
|
|
| [reply] |
|
|
The apprentice takes a shot at expanding on D'oh!, just to make sure he's been paying attention...
Presumeably because push appends the element to the array and use lib prepends it.
The first would, I think, work when you've installed a module into your local area that is already available in the standard area. Why would you do this? Perhaps you need (want) to use (or experiment with) a later version. Perhaps you're not the admin and the real admin is busy, lazy, or charges you to install stuff. Perhaps the existing one is severely broken for some reason (e.g. a bad install). Perhaps you're trying to make sure your stuff is searched before anything else.
The latter is, I believe the preferred approach and should be used unless you know why it won't work for you.
--f
| [reply] |
|
|
|
|
| [reply] |
|
|
| [reply] [d/l] [select] |
|
|
You need to escape the backslash with another backslash:
print "C:\\ads\\lib";
| [reply] [d/l] |
|
|
|
|
|
|
Can @INC be modified using environment variables in Win?
by yudel (Novice) on Jun 19, 2001 at 01:19 UTC
|
A related question: I'd like to add a directory to @INC globally,
without changing my programs.Can it be done using an
environment variable in Win? Or perhaps some other way?
Larry | [reply] |
|
|
Hi,
The 'set' command will work for a given cmd window (or always, if you run it in a batch file or 'system' call at the beginning of the script).
If you want to set it permanently, go to: control panel->system->advanced->environment variables and set PERL5LIB there. (This is on Win2K, but if I recall it's the same on NT4)
- perchance
| [reply] |
|
|
In Windows, the starting path is stored in the registry, but not really documented as to where -- you can find it if you look, though. In general, you can use an environment variable (PERL5LIB I think) which is combined with that starting path.
| [reply] |
|
|
| [reply] [d/l] |
|
|
| [reply] |
|
|
|
|