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

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

(Note: I'm running Ubuntu 9.10 on i386.)

I've installed a great many modules from CPAN using sudo cpan. I've installed a great many .deb packages using appropriate methods, some of which seem to contain Perl modules, too. I've also run into a spot of trouble (although I can't swear cpan has a thing to do with it) with conflicts between modules installed from these different sources. (Synaptic itself seems to rely on XML::SAX, for example.)

Various forum posts of dubious reliability and a buddy of mine suggest I never install any modules with cpan unless there is no alternative; rather, prefer to install only using Synaptic, apt-get, and friends.

What say the Monks?

Update: Great comments, thank you. I will leave the system perl and its libraries alone; if I install an application that requires modules, I'll let Synaptic take care of the dependencies. I'll compile a distinct development perl somewhere else and use cpan to install whatever I like there. I'll use the opportunity to consider different compilation flags, too.

Replies are listed 'Best First'.
Re: Installing Modules
by Corion (Patriarch) on Feb 14, 2010 at 16:51 UTC

    If you use the perl executable provided by your system vendor, only install modules into it through your package manager, also provided by your system vendor.

    If you use your perl, compiled by yourself, only install modules into it using cpan.

    Leave the two separate, and in my opinion, leave the system Perl to the system vendor, because your whole system will break in various parts if you install/upgrade to an incompatible version of a module that is crucial, for example for your system package manager, if that happens to be written in Perl.

Re: Installing Modules
by Anonymous Monk on Feb 14, 2010 at 16:53 UTC

    Never install within the system perl using both CPAN and your package manager. You WILL get conflicts. Instead, do one of two things:

    1. Compile your own perl (NOT to the same location) and install CPAN modules to that.
    2. Install local::lib using Synaptic, apt-get, etc... and use its abilities to create a local modules area that CPAN installs to.

    I repeat. NEVER install modules within the system perl using CPAN if you have a package manager.

Re: Installing Modules
by skx (Parson) on Feb 14, 2010 at 19:36 UTC

    I second (third?) the previous comments. If you're upon Ubuntu you shouldn't install modules via CPAN, as there will be confusion sooner or later.

    However all is not lost - if there is a module you wish to you which isn't availalbe as .deb you can create it, using dh-make-perl.

    See this article I wrote on the subject a while back.

    Steve
    --
Re: Installing Modules
by zwon (Abbot) on Feb 14, 2010 at 23:35 UTC

    I'm also using Ubuntu. After 5.10.1 was released I decided to upgrade system perl. Of course I was aware that replacing system perl is not recommended practice, and it may cause numerous problem, but it didn't stop me. I've get source packages for 5.10.1 from packages.debian.org, built and installed. I'm using it on all my desktops since September, installing modules with cpanp (they go in /usr/local), and quite happy. I didn't get a single problem. There are no conflicts, as cpanp installs modules into /usr/local and packaged modules are installed into /usr.

    I don't want to say that you should ignore recommendations of previous posters, but just informing you that I did and got a positive result.

      All Slackware versions, including the latest v13.0, have absolutely no problems with upgrading or replacing the provided Perl with your own version. You can also install and update Perl modules as you like. The trick here is that Slackware is one of the few distributions that don't rely on Perl for getting their job done, but uses Bourne shell scripts instead (not even bash, so you can use ash or dash as /bin/sh, if you like).

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: Installing Modules
by shmem (Chancellor) on Feb 19, 2010 at 14:59 UTC

    Never say never... I'm running Fedora, and I'm using the system perl. I do install CPAN modules not present in the Fedora repositories - but not via cpan: I roll my own RPMs with cpanspec, then install those via rpm - all dependencies in place. You can do the same on debian - build CPAN modules into deb packages.