Understanding what I am calling the mess that is perl modules

Ryan Schmidt ryandesign at macports.org
Wed Jan 21 04:46:25 PST 2009


On Jan 21, 2009, at 06:34, Scott Haneda wrote:

> On Jan 21, 2009, at 4:27 AM, Scott Haneda wrote:
>
>> On Jan 21, 2009, at 3:19 AM, Emmanuel Hainry wrote:
>>
>>> There was an attempt at that: cpan2port
>>> [http://www.nabble.com/announce:-cpan2port-td20415884.html]. I don't
>>> know what is its current status, but that's a nice thing. If it  
>>> was also
>>> possible to have this for python eggs, ruby gems, ctan, etc.  
>>> However,
>>> debian has had such a tool for a long time, other package  
>>> managers also
>>> have.
>>
>>
>> Cool, thanks.
>> I downloaded it, and moved it to ~/bin which is in my path.
>>
>> When I run it with no arguments to get to help for it, I get  
>> errors, which reference macports, which I should not, since I am  
>> using the built in perl in OS X.
>>
>> $whereis perl
>> /usr/bin/perl
>
>
> I think I am sort of seeing what is going on here. perl -V is using  
> the macports version for some reason.   would think that `perl`  
> needs to continue to use the OS X perl, and that I would need to  
> call out the /opt/local/bin/perl when I want to use the MacPorts one.

If you list /opt/local/bin first in your path, before /usr/bin, then  
sure, MacPorts perl will be used (in your Terminal) in preference to  
Apple perl. Same for any other program that exists in both locations.  
That's the whole reason we recommend putting (and set up for you, in  
the default .profile) /opt/local/bin first in the path -- so that you  
get MacPorts versions where available, since they are usually newer.


> I came to this conclusion since when making a port, one of the main  
> things the port does, is read in files and do a find and replace on  
> the built in perl and stuff in /opt/local/bin/perl.
>
> If that is the case, then it has to be my .bashrc file that is  
> messing with the proper behavior.
>
> I have the usual
> export PATH="$PATH:$HOME/bin"
>
> And I added in
> # For MacPorts
> export PATH=/opt/local/bin:/opt/local/sbin:$PATH
> export DISPLAY=:0.0
> export EDITOR=/usr/bin/mate
>
> I had to ditch the pre-installed .profile since it did not work for  
> me. Maybe I should have referenced it from this file.  How do I  
> tell the shell to use a certain order on where perl is located, or  
> is that the wrong way to solve this?

The shell searches for binaries in the paths in PATH and runs it in  
the first path where it's found.


> Also, is there any way for EDITOR to be dynamic, so that when I am  
> on the actual machine I want to use mate as my editor, but if I am  
> over ssh, I want to use a terminal based editor.  Is that just a  
> matter of wrapping the default in a condition that checks where I  
> am at?

I would also be interested in knowing how to set that up. I've wanted  
this many times but never really looked into what I would need to do.




More information about the macports-users mailing list