How do you manage perl modules on a Debian system?

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.


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.


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

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


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.