Hi Scott,

Ok, I see what you mean now -- thanks for the clarification!


Scott Haneda wrote:
On Jan 22, 2009, at 10:54 PM, Raymond Wan wrote:
Scott Haneda wrote:
...
As you can see, the /opt/local/perl lists the @INC paths, and 100% of them are in /opt/local so why when I use #!/opt/local/bin/perl -- for the interpreter in a script, does that script run around and use other locations?


At least one way I can think of is that you have these paths set in the PERL5LIB 
environment variable (or equivalent for Mac, if different).  You have two versions 
co-existing and one was installed through Apple and the other by yourself via Macports (I 
don't know what Macports is, but I can guess).  The Apple install probably sets some 
environment variable during the installation in the list of environment variables for all 
users and each user might read from it. That's my guess...  You may want to check out the 
environment variables and grep for something that has the paths that are being added 
(under Linux/bash shell, I use "env" to do this).

This doesn't happen the other way around because you manually installed 
Macports and that manual installation didn't automagically change environment 
variables for all users.

This is the reason I could think of for the difference in behavior.

Seems besides PERL5LIB, PERLLIB could also be the culprit:  
http://perldoc.perl.org/perlfaq8.html#How-do-I-add-a-directory-to-my-include-path-(@INC)-at-runtime%3F


They most likely aren't the same and if so, the problem is just that the modules you want (Email::Valid, etc.) have been installed for one version and not the other.

Correct. The modules I want are not installed in /usr/bin/perl, they are in /opt/local/bin/perl the problem is that 12 of the modules in /opt/bin/perl are being used, and of them are not. I can not determine why three are being excluded.

I am going to add /opt/local/bin to my $PATH as the first item, and test that, just for kicks.


Add it using:

use lib ...

in your code OR the PERL5LIB environment variable.  See this for help on the 
former:

http://perldoc.perl.org/lib.html


Multiple versions of perl can co-exist, of course. So, if you do find an old one, you don't need to uninstall it.

So is it correct, that is I use /opt/local/bin/perl as the interpreter in a script, it should only use the modules that @INC reports for -V ?


"Should" unless the user has appended (prepended) to it.  This could be done manually or 
behind the scenes without you knowing as part of the installation.  That said, I am not so sure if 
the PERL5LIB env variable would be reflected by "perl -V".


That is exactly what I am doing, aside from modules that were not included with it, I of course had to build and install those on my own, but I pointed their destination to /opt


For what it's worth, in a multi-user system, a user could compile their own 
modules, put it in their home directory and then add that directory to 
PERL5LIB.  So, you don't have to put them in /opt.

Anyway, I'm not sure if the above helps you.  Hopefully the above will tie you 
until someone more knowledgeable cuts in and corrects me...  :-)  Good luck!

Ray



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to