http://qs321.pair.com?node_id=285799

CAVEAT

Respected monks have mentioned drawbacks to this approach, and alternative methods.   This method has worked well for me so far, but I'd encourage you to read and consider the other posts in this thread. Props to da monks for feedback.   8^)

OBJECTIVE

Install a second, parallel & independant, Perl on a Debian host without breaking Debian's dependance on its own provided Perl, *and* without dipping into Debian testing or unstable distributions.

BACKGROUND

The Debian GNU/Linux distribution uses Perl for some of its key/core operations, and many Debian packages require deb-packaged perl modules, which are generally quite old.   This can cause problems for a Debian-using Perler, which boil down to conflicts between Debian and Perl's package management systems.

By installing a parallel Perl, a Debian user can install deb-packaged Perl modules to his heart's content, while still intalling ofttimes newer modules from CPAN to the second Perl.   The only drawback I know of is that modules will need to be installed separately for each Perl install - via apt-get for system, and CPAN for user.

Comments, corrections, and improvements are welcome and invited.


PREREQUISITES/ASSUMPTIONS

  • working installation of Debian Woody
  • active Internet connection
  • competence (not necessarily expertise) with both Linux and Perl
  • Debian Woody (stable)
  • Debian Perl 5.6.1
  • Perl Perl 5.8.0

ACTIONS

1.fetch, extract, and install Perl 5.8.0

wget http://cpan.org/src/stable.tar.gz
tar -zxvf stable.tar.gz
cd perl-5.8.0
rm -f config.sh Policy.sh
sh Configure -de
make
make test
make install

2.revert system Perl to Debian-standard 5.6.1

cd /usr/bin
rm perl
ln -isv perl5.6.1 perl

3.set user Perl to 5.8.0

cd /usr/local/bin
rm perl
ln -isv perl5.8.0 perl

4.confirm new Perl 5.8.0 is user Perl

perl -e 'print "$]\n";' should tell you "5.008".
Make sure this is right before proceeding to step 5, or you won't be doing what you want to be doing, and may very well hork your Debian install beyond recognition.   Here there be dragons.

5.install desired modules

Use your favorite method (CPAN or CPAN autobundle or CPANPLUS or fetch/perl Makefile.PL/make/make test/make install) to install your favorite modules for your favorite shiny new Perl.

A snippet to list installed non-core modules:

#!/usr/bin/perl -w # modver.pl 2003-08-22 07:05 CDT ybiC # commandline tool gens list of installed non-core Perl modules & thei +r versions # shamelessly stolen from, I mean inspired by, jeffa & hacker use strict; use ExtUtils::Installed; my $delim = shift || ' '; my $inst = ExtUtils::Installed->new(); print $inst->version($_), $delim, $_, $/, for $inst->modules();

perldoc perllocal will do similarly, but with significantly more verbose output.


SUNDRY NOTES

check path and Perl versions

set|grep PATH
PATH= ...:/usr/local/bin:/usr/bin:...
whereis perl
  perl: /usr/bin/perl /usr/local/bin/perl ...

perl -e 'print "$]\n";' 5.008
/usr/local/bin/perl -e 'print "$]\n";' 5.008
/usr/bin/perl -e 'print "$]\n";' 5.006001

Perl binary executables

/usr/bin/perl              symlinked to ./perl5.6.1 by /me
 /usr/bin/perl-5.6          Debian-standard
 /usr/bin/perl5.6.1         Debian-standard
 /usr/bin/perl5.8.0         from source
 /usr/local/bin/perl        symlinked to ./perl5.8.o by /me
 /usr/local/bin/perl5.8.0   from source

perl module directories

core debian:
   /usr/lib/perl/5.6.1/
   /usr/share/perl/5.6.1/
non-core debian:
   /usr/lib/perl5/
core from source:
   /usr/local/lib/perl5/5.8.0/
none-core installed by user:
   /usr/local/lib/perl5/site_perl/5.8.0/

Debian docs

/usr/share/doc/debian-policy/perl-policy.html/
/usr/share/doc/libperl5.6
/usr/share/doc/perl/
/usr/share/doc/perl-base/
/usr/share/doc/perl-doc/
/usr/share/doc/perl-modules/

Debian admin/config perl scripts, modules

/usr/share/perl5/

LINKS


CREDITS

Thanks to hacker, jeffa, tye, and I forget who else for consciously or otherwise helping me get this much figured out.   Oh yeah, and some guy named vroom.


TODO

  • include info from Intrepid's excellent reply below, as viable alternative.
  • clarify problems caused by Debian's internal use of Perl, Debian's CPAN module packaging, and by Perl's CPAN package handling, as suggested below by brer theorbtwo
  • Document making Debian package(s) of additional Perls

UPDATES

2003-09-14   12:55 CDT
  • break out 'sundry notes' into sections
  • number 'actions'
  • add bit o'verbosity to step 4
  • add 'prerequisites'
  • squink CPAN, Debin links to avoid lateral scrolling of page as per brer tye
  • further formatting tweaks for same
  • balanced <readmore> tags
  • clarify verbage in 'objective'
  • fix splleing error as per by brer ChemBoy
  • break out 'background' from 'objective'
  • mention CPAN autobundlue as per ser menolly
  • mention perdoc perllocal
  • add 'to do'
  • correct "cd /usr/bin/perl" (brain|typ)o as perl brer barrd
  • trailing <hr /> for visual separation, instead of equal signs in <h2>s, courtesy brer Aristotle
  • add 'debianize packages' to TODO, courtesy brer Fatvamp

Replies are listed 'Best First'.
Re: Install parallel Perl on Debian
by Intrepid (Deacon) on Aug 23, 2003 at 05:37 UTC

    Credits to you for posting on this topic. I've been interested in how to approach "the Debian Problem" since I got started using GNU/Linux late last year. I've done a lot of thinking about this too, but didn't post any write-ups about it yet.

    There's an excellent article about "Juggling Perl Versions" in the Jan 2003 issue of The Perl Journal that deals with the same motivations which you introduced here. This article, authored by Matt Persico, has information about creating a system whereby an administrator can make an unlimited number of Perl versions available to users without compromising such things as Debian's system dependencies.

Re: Install parallel Perl on Debian
by theorbtwo (Prior) on Aug 23, 2003 at 20:15 UTC

    You didn't note why running a non-default perl with Debian was a problem that I noticed. The reasons are two simple facts that merge to somthing annoying. The first is that key parts of Debian's infrastructure are written in perl. The second is that perl 5.8.0 (IIRC) makes changes to the meaning of v5 => 'yadda'. Combine these, and you get a dpkg that no longer works, and thus a system that is quite screwed, until you either revert your perl, or fix the incompatable bits of script.


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Re: Install parallel Perl on Debian
by menolly (Hermit) on Aug 22, 2003 at 23:02 UTC
    The CPAN module's autobundle function might be useful in step 5.
Re: Install parallel Perl on Debian
by PetaMem (Priest) on Sep 14, 2003 at 14:13 UTC
    Hi,

    Please forgive me my honestness/undiplomacy in the following lines.

    Oh god this is such a kludge one couldn't believe it. If one wants to use different perls in parallel, it shouldn't be sticked to just 2 instances, but generally to n, furthermore these perls should be installed with your familiar package manager (being made a package before), and last but not least you should have an user program that would *for every user on the system* a) list the available perls, b) show the current perl he uses c) allow to switch between perls for this user only.

    having said all that, we have such a system for SuSE Linux and will publish it (brother ph0enix will) within the next month (i.e. when he returns from vacation and does some garbage collection of the pending duties ;-)).

    Bye
     PetaMem
        All Perl:   MT, NLP, NLU