Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have 2 versions of perl installed on my ubuntu linux machine, perl 5.8.7 and activestate perl 5.8.8. The older version is the default. Here is the output from perl -v::
This is perl, v5.8.7 built for i486-linux-gnu-thread-multi (with 1 registered patch, see perl -V for more detail) Copyright 1987-2005, 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 ki +t. 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 Pa +ge.
I'd like to make the activestate version default, but if I go to uninstall the old perl ubuntu wants to also uninstall a bunch of other stuff I don't wish to get rid of, such as gaim, evolution and firefox just to name a few. Is there a good way to either disable the old version and keep all the other stuff or to make the new perl the default?

TIA

Replies are listed 'Best First'.
Re: default perl on linux
by Corion (Patriarch) on Sep 02, 2006 at 16:47 UTC

    To give you a word of advice by somebody who severely damaged his Debian distribution by installing a different perl executable - don't. The system Perl executable should never be changed other than through the vendor's own upgrade mechanism. Yes, this means you should install your own Perl separately if the system Perl is not enough for you.

    For example, Debians (and by inheritance, Ubuntus) apt-get was at some time (and I presume it still is) written in Perl - if you install another Perl, all the modules needed by apt-get will become unavailable to your new Perl unless you manually hunt them down and copy them over. The Debian folks didn't put these modules onto CPAN so you can't conveniently install them into other Perls, either.

      I have maintained 2 versions of perl on a box for several years. Interchange required a non-threaded perl and Fedora/RH (in thier wisdom) only distributes threaded perl. Thier threaded perl also has a load of dependancies to system tools. Though none of the tools relied on threads (which makes the least sense of all). My situation has since changed, due to some package finagling, I now only run non-threaded perl, but my distro thinks it's the regular version (advice on the Interchange Mailing List)

      It's a pain - I had one in /usr/bin/ and the other /usr/local/bin/. The biggest and most frequent pain (but not the only) was I had to match modules to both verions - which means double installs (which is quite easy to forget). You also have to exclude perl updates in yum.

      My advice - ditch one version or if you need to stay really current find a way to compile.



      grep
      Mynd you, mønk bites Kan be pretti nasti...
Re: default perl on linux
by Tanktalus (Canon) on Sep 02, 2006 at 21:30 UTC

    I had the same issue on RHEL3. My answer was to put my personal Perl into /usr/local/bin (its default when you compile it yourself), and then I just put /usr/local/bin in my PATH first.

    Yes, some scripts start with "#!/usr/bin/perl" - but that's ok, those are the ones that got installed with the system perl anyway. The ones that get installed via Makefile.PL or Build.PL which were themselves run with the new perl will actually start with "#!/usr/local/bin/perl" - the script convert function there will put the right header on them based on $^X. Now scripts that were installed as part of the OS would refer to /usr/bin/perl, while scripts that were installed via CPAN would refer to /usr/local/bin/perl. And scripts I run at the commandline would be automatically run via /usr/local/bin/perl (because it's first in the PATH). The only thing left is to remember to write my ~/bin scripts to refer to /usr/local/bin/perl as their first line.

    Now I run Gentoo, and have never been more than two points behind the current perl (e.g., just after 5.8.8 was released, I think I was still at 5.8.6 - soon became 5.8.7, and now it's up to 5.8.8), so it's not really that big of a deal. And Gentoo allows you to choose threading or not during the emerge process (defaulting to not threading). Though I had to change that at one point to get mod_perl to install.

Re: default perl on linux
by zentara (Cardinal) on Sep 02, 2006 at 16:44 UTC
    You might have some luck by manipulating your $PATH ENV variable. Most systems are setup to search /usr/local/bin first, then /usr/bin. That way, if you have 2 perls, one in /usr/local and 1 in /usr. the /usr/local will be found first if you type "which perl".

    That said, you can get very creative by putting a symlink /usr/local/bin/perl and have it point to wherever you have activestate's perl located. It should be found first.

    Other than that, you can manually delete files, rather than relying on the rpm system( yuck I hate rpm's).


    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      This wouldn't help if your scripts start with #!/usr/bin/perl like many scripts do.