Friday, April 9, 2010

Installing Perl Modules on Debian

Disclaimer: I know next to nothing about Perl - I'd appreciate any comments.

Many CPAN hosted Perl modules are already packaged in Debian, so all one needs to do is the following:
  1. install dh-make-perl:
    aptitude install dh-make-perl
  2. find the Debian package that contains the wanted Perl module:
    dh-make-perl locate Chocolate::Belgian
  3. if the module has a matching Debian package, you should install it the usual way:
    aptitude install libchocolate-belgian-perl
  4. otherwise, you have two options - read on
One option is to to do it the Perl way, i.e. install the package using the CPAN core module:
perl -MCPAN -e 'install Chocolate::Belgian'
Another approach is to use dh-make-perl to automatically Debianize the module, and then install the resulting .deb package, like this:
cd /tmp
dh-make-perl make --build --cpan Chocolate::Belgian # or: cpan2deb Chocolate::Belgian
dpkg -i libchocolate-belgian-perl_0.01-1_all.deb
You may run into errors due to missing Perl modules that the original missing module depends on. If this happens, you'll need to repeat the installation process for each missing module (again, either from an existing Debian package or using dh-make-perl).

I suppose the latter method makes sense if, like me, you only need a small number of non-Debianized Perl modules installed - I like being able to manage these modules with the usual Debian tools such as aptitude, instead of having to learn to effectively use yet another package maintenance tool.

1 comment: