Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to install perl 5.10 on my OS X 10.5.8 box.

I have macports installed. And I seem to have port perl5.10 installed as well:

$ sudo port install perl5.10
Password:
--->  Computing dependencies for perl5.10
--->  Cleaning perl5.10

However current perl version is still 5.8.8

$ which perl
/opt/local/bin/perl

$ perl --version

This is perl, v5.8.8 built for darwin-2level

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

$ /opt/local/bin/perl --version

This is perl, v5.8.8 built for darwin-2level

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

What am I missing?

share|improve this question
    
Do the macports install logs say that /opt/local/bin/perl was the install location? It may have picked somewhere strange to go instead, or perhaps the installation failed in an obscure way that you missed? –  Ether Sep 20 '09 at 17:58
1  
Have you considered accepting an answer so the user receives points? –  Nerdling Oct 1 '09 at 19:07

2 Answers 2

up vote 2 down vote accepted

Where was each version installed?

  • /usr/bin/perl is 5.8.8

So, the first thing to check is your PATH variable.

Then look at other places - /usr/local/bin and so on - to see where the new version was installed.

For myself, I build my own Perl, leaving the system one to the system; it is in $HOME/perl/v5.10.1/bin/perl, near version 5.10.0.

I use this script - called 'which' - to establish which version of a program I'm using. Used with 'which -a perl', it would tell me all the possible copies of Perl I could be using...

#!/bin/sh
#
# @(#)$Id: pathfile.sh,v 2.1 2008/07/14 17:42:13 jleffler Exp $
#
# Which command is executed

# Loosely based on which from Kernighan & Pike "The UNIX Programming Environment"

oldpath=$PATH
PATH=/bin:/usr/bin

usage()
{
    echo "Usage: $0 [-afrwx] [-p path] command ..." >&2
    exit 1
}

tflag=-x
aflag=no
while [ $# -gt 0 ]
do
    case $1 in
    -[frwx])
        tflag=$1
        shift;;
    -p) oldpath=$2
        shift 2;;
    -a) aflag=yes
        shift;;
    --) shift;
        break;;
    -*) usage;;
    *)  break;;
    esac
done

case $# in
0)  usage;;
esac

PATHDIRS=`echo $oldpath | sed ' s/^:/.:/
                            s/::/:.:/g
                            s/:$/:./
                            s/:/ /g'`


for cmd in $*
do
    fflag=no
    case "$cmd" in
    */*)
        if [ ! -d $cmd ] && [ $tflag $cmd ]
        then echo $cmd
        else echo "$cmd: not found" 1>&2
        fi;;

    *)
        for directory in $PATHDIRS
        do
            if [ ! -d $directory/$cmd ] && [ $tflag $directory/$cmd ]
            then
                echo $directory/$cmd
                fflag=yes
                [ $aflag = no ] && break
            fi
        done
        if [ $fflag = no ]
        then
            echo "$cmd: not found" >&2
        fi
    esac

done
share|improve this answer
    
Isn't this provided by /usr/bin/which? –  Nerdling Oct 1 '09 at 18:55
1  
It depends which which you have as /usr/bin/which. The machines I used back in the late 80s didn't have any which in any system bin directory, which was a nuisance. Hence I cribbed this code. I added the -a, -r, -w, -x options relatively recently. If you've got a functional which, you don't need this one; if you don't, it may save you some grief. –  Jonathan Leffler Oct 2 '09 at 2:51

I guess it would be named perl5.10 and not just perl.

share|improve this answer
2  
You can run port contents perl5.10 to be sure, but mostly like the Perl 5.10 executable is perl5.10. –  mipadi Sep 24 '09 at 20:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.