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'd like to know if you have a method for managing perl modules on your Debian system, with respect to the following:

  1. Installing new modules
  2. Listing of manually installed modules
  3. Checking dependencies, and uninstalling modules

I have looked at this perlmonks article for background reading: What is the best way to install CPAN modules on Debian?

I have previously installed perl modules using the CPAN module. I have also used dh-make-perl in some cases, when following instructions to build other packages that had perl dependencies.

I'd like to institute a coherent policy on my machine so I can better manage how and where the modules are installed, and reduce the chance of breaking perl on my system. I would strongly like a system where I can detect and uninstall modules that are no longer being used.

share|improve this question
    
See also stackoverflow.com/questions/398221/… –  Ether Jan 24 '10 at 19:10
    
isn't superuser kind of end-user centric and isn't perl management a sysadmin or home-guy-learning-sysadmin stuff? –  Warren P Jul 23 '10 at 14:30

4 Answers 4

up vote 5 down vote accepted

If you use apt-get and dh-make-perl for all packages, deborphan --guess-perl will find perl packages without any dependencies, which you can then remove and run it again iteratively. deborphan has a keep list which you can add the ones you're actively using to and they won't show up.

So to make this work, you'll have to uninstall all the modules you installed via CPAN and reinstall them with dh-make-perl. Manually installed modules can be detected by looking for "No available version in archive" in the ouptut of apt-show-versions libsome-module-perl.

share|improve this answer

I use apt-get to install most modules. If a module is not in one of the repository (or if I need a latter version of a module), I install that module into my home directory with cpan. This is made easier by the local::lib module. Download the tarball from CPAN, decompress it, change directory into it, and then type

perl Makefile.pl --bootstrap
make
make test

If any of these steps fail, ask a question here. If all of the steps succeed then type

make install

You will then need to add the following line to whatever profile file you use (e.g. ~/.profile, ~/.bash_profile, etc.):

eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)

Log out and log back in (run that command in the current terminal), and then type

cpan

It should ask you if you want to auto-configure CPAN, answer yes. When it is done you should be able to install modules to a directory named ~/perl5 by saying

cpan Module::Name

The line you put in your profile sets up the PERL5LIB variable, so programs will be able to find the modules you installed. It puts the ~/perl5 directory ahead of the system directories, so if you have version 1.0 of Foo installed via apt-get and version 2.0 of Foo installed via CPAN, the CPAN version will be loaded.

share|improve this answer
    
+1. This makes WAY more sense to me than running two completely separate perl instances/installs. –  Warren P Jul 23 '10 at 14:32

Leave Debian's Perl alone and install a second Perl that you manage with cpan:

http://stackoverflow.com/questions/398221/how-do-you-manage-perl-modules-on-linux

share|improve this answer
    
I like this approach, but for one issue: Some modules I install are to satisfy dependencies in other packages that I'm aiming to build and install on my machine. If I install a second Perl, won't I have to jump through hoops to make these packages see and use the 2nd Perl at runtime, while system installed packages continue to use the original install? –  nagul Sep 25 '09 at 0:36
    
No hoops at all. –  innaM Sep 25 '09 at 9:39
    
ouch. especially if any of your perl stuff touches any debian stuff. –  Warren P Jul 23 '10 at 14:31

Depending on the modules, I'm fairly sure you can use the apt-get command to install some of the more common modules.

apt-get install perl5-crypt (maybe its p5-crypt - its been a while).

It depends a lot on what modules are required though, many of them are not in the apt packages.

share|improve this answer
    
Yes, that's a problem for me because I now have a system where some modules have been installed via apt-get, some via dh-make-perl and still others via the CPAN module. –  nagul Aug 22 '09 at 13:01

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.