Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / January 2006



Tip: Looking for answers? Try searching our database.

@INC

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
The Ghost - 05 Jan 2006 18:15 GMT
How can I permanently add to @INC?  I have 2 versions of perl  
installed and only use one of them.  The reason for 2 versions is a  
port system that refuses to rely on the already installed perl.  So I  
have:

$ /usr/bin/perl -e 'print join("\n", @INC)'
/System/Library/Perl/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/5.8.6
/Library/Perl/5.8.6/darwin-thread-multi-2level
/Library/Perl/5.8.6
/Library/Perl
/Network/Library/Perl/5.8.6/darwin-thread-multi-2level
/Network/Library/Perl/5.8.6
/Network/Library/Perl
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.8.6
/Library/Perl/5.8.1

AND

$ /opt/local/bin/perl -e 'print join("\n", @INC)'
/opt/local/lib/perl5/5.8.7/darwin-2level
/opt/local/lib/perl5/5.8.7
/opt/local/lib/perl5/site_perl/5.8.7/darwin-2level
/opt/local/lib/perl5/site_perl/5.8.7
/opt/local/lib/perl5/site_perl
/opt/local/lib/perl5/vendor_perl/5.8.7/darwin-2level
/opt/local/lib/perl5/vendor_perl/5.8.7
/opt/local/lib/perl5/vendor_perl

I really only want to use /usr/bin/perl, but the port system will put  
modules into the /opt/local/bin/perl version which I want to use  
from /usr/bin/perl.

Thanks!
Doug McNutt - 05 Jan 2006 18:51 GMT
>How can I permanently add to @INC?  I have 2 versions of perl  installed and only use one of them.  The reason for 2 versions is a  port system that refuses to rely on the already installed perl.

Try setting the PERL5LIB environment variable. It's formatted like a $PATH for perl. I set it in $HOME/.MacOSX/environment.plist so that it works when initiated from a Cocoa or Carbon application.

You may have a problem with incompatibility of stuff in an @INC area that demands another version of perl. That's why the ports don't attempt to mix things up.

Signature

--> Science is the business of discovering and codifying the rules and methods employed by the Intelligent Designer. Religions provide myths to mollify the anxiety experienced by those who choose not to participate. <--

John Delacour - 05 Jan 2006 20:01 GMT
>...I have 2 versions of perl installed and only use one of them.
>The reason for 2 versions is a port system that refuses to rely on
[quoted text clipped - 6 lines]
>/opt/local/lib/perl5/5.8.7/darwin-2level
>/opt/local/lib/perl5/5.8.7 ...

If you download 5.8.7 and let it install itself in the default
location without bothering even to look at the difficult questions, I
guess you will solve all you problems and end up with this:

  @INC:
    /usr/local/lib/perl5/5.8.7/darwin-2level
    /usr/local/lib/perl5/5.8.7
    /usr/local/lib/perl5/site_perl/5.8.7/darwin-2level
    /usr/local/lib/perl5/site_perl/5.8.7
    /usr/local/lib/perl5/site_perl/5.8.6/darwin-2level
    /usr/local/lib/perl5/site_perl/5.8.6
    /usr/local/lib/perl5/site_perl

Whatever you have in /opt or whatever other non-standard directory
can then porbably be safely consigned to the trash.

JD
The Ghost - 05 Jan 2006 20:41 GMT
The other perl was installed by darwinports.  It doesn't ask  
questions.  If it did, I wouldn't install it.  I'm not concerned  
about incompatibilities as the perl versions are so close.  I could  
reconfigure darwinports, but I don't want to.  So this isn't a  
solution to my issue.

Thanks though.

Ryan

>> ...I have 2 versions of perl installed and only use one of them.  
>> The reason for 2 versions is a port system that refuses to rely on  
[quoted text clipped - 24 lines]
>
> JD
Joel Rees - 05 Jan 2006 22:47 GMT
> The other perl was installed by darwinports.  It doesn't ask
> questions.  If it did, I wouldn't install it.  I'm not concerned about
> incompatibilities as the perl versions are so close.  I could
> reconfigure darwinports, but I don't want to.  So this isn't a
> solution to my issue.

I suggest you configure your Darwinports anyway.

> Thanks though.
>
[quoted text clipped - 28 lines]
>>
>> JD
Sherm Pendley - 05 Jan 2006 22:57 GMT
> The other perl was installed by darwinports.  It doesn't ask  
> questions.  If it did, I wouldn't install it.  I'm not concerned  
> about incompatibilities

You should be.

> as the perl versions are so close

The versions are close, but the architectures aren't the same. Binary  
modules will be incompatible.

>>> ...I have 2 versions of perl installed and only use one of them.  
>>> The reason for 2 versions is a port system that refuses to rely  
[quoted text clipped - 5 lines]
>>>
>>> /opt/local/lib/perl5/5.8.7/darwin-2level

The system default Perl is multi-threaded, but the one installed by  
DarwinPorts is not. Binary modules compiled for one will not work  
with the other. That's why there's an architecture-specific  
subdirectory in the first place - it's not just there to annoy you! :-)

If you want scripts that begin with "#!/usr/bin/perl" to use the Perl  
that's managed by DarwinPorts, you can delete /usr/bin/perl - it's  
just a link to /usr/bin/perl5.8.6, so you already have a backup. Then  
replace it with a symbolic link to /opt/local/bin/perl. Like this:

    sudo rm /usr/bin/perl
    sudo ln -s /opt/local/bin/perl /usr/bin/perl

Note that if you do this, *every* script that begins with "#!/usr/bin/
perl" will be using the DarwinPorts Perl - including the scripts that  
Apple supplies, which have not been tested and verified with that  
configuration. As you've said, the difference is small, so problems  
are very unlikely, but still possible.

The safest route is to leave /usr/bin/perl alone, since Apple-
supplied scripts don't rely on any external modules anyway, and use  
"#!/opt/local/bin/perl" in your own scripts, so that they use the  
DarwinPorts Perl and any modules you've installed for that.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.