in reply to how to install perl 5.10.1 on ubuntu9.10?

To install your own Perl, follow these steps:

sudo su - cd /opt mkdir perl-5.10.1 mkdir src cd src wget http://cpan.org/src/perl-5.10.1.tar.gz tar xzf perl-5.10.1.tar.gz cd perl-5.10.1 rm -f config.sh Policy.sh ./Configure -Dprefix=/opt/perl-5.10.1 make make test make install cd /opt ln -s perl-5.10.1 perl exit

And you're done. Do not add /opt/perl/bin to your (or root's) $PATH.

To install modules for your own Perl, use /opt/perl/bin/cpanp. Never use /usr/bin/cpanp or /usr/bin/cpan. (To install Perl modules for the system Perl, continue to use aptitude.)

Always use the fully-qualified shebang line at the beginning of scripts that you explicitly want to use /opt/perl/bin/perl:

#!/opt/perl/bin/perl ...

Replies are listed 'Best First'.
Re^2: how to install perl 5.10.1 on ubuntu9.10?
by przemo (Scribe) on Nov 19, 2009 at 09:38 UTC
    Do not add /opt/perl/bin to your (or root's) $PATH.

    What is wrong with prepending own's Perl bin dir to $PATH (not root's, agreed)? I do it all the time, no problems so far.

    Always use the fully-qualified shebang line at the beginning of scripts that you explicitly want to use /opt/perl/bin/perl:

    OK, this shows the occasional use-case for custom Perl. However, if you want your scripts to be portable, do not hard-code paths. Instead, set $PATH and use something like

    #!/usr/bin/env perl

    which is much more portable.

      What is wrong with prepending own's Perl bin dir to $PATH (not root's, agreed)?

      Gah. I really need to create an account here so I can edit my posts. You're right, thanks for the correction. I should've written "Do not add /opt/perl/bin to root's $PATH". As you point out, prepending it to your own (not-root) $PATH works great.

      The only reason I can think of that you might not want to add it to your own (not root) $PATH is that, when logged in as yourself, you'll get used to always automatically getting /opt/perl/bin/perl, and then when you log in as root, you'll run some code may forget that you're back to getting /usr/bin/perl. :)

      do not hard-code paths

      You should always hard-code paths as part of the install process, otherwise use /your/favorite/perl yourperlprogram