Wednesday, September 2, 2009

Finding perl packages with APT

If you are attempting to satisfy dependencies for perl software that was NOT available via your favourite repository (this is sometimes unavoidable in enterprise environments) you should AT LEAST attempt to satisfy those dependencies using said repository. The easiest solution is to install 'apt-file' from your repo and for any perl modules you can simply call:
apt-file search "LWP::UserAgent"

This will return the following list on Debian Lenny:
liblwp-useragent-determined-perl: /usr/share/man/man3/LWP::UserAgent::Determined.3pm.gz
libtest-mock-lwp-perl: /usr/share/man/man3/Test::Mock::LWP::UserAgent.3pm.gz
libwww-perl: /usr/share/man/man3/LWP::UserAgent.3pm.gz

Now you know that in order to satisfy a dependency on "LWP::UserAgent" you would need to install the 'libwww-perl' module from the repo.

If the module is not available via the repo you should next consider installing the package into a custom perl lib directory specifically for the software (and/or user account) in question. To do this read the documentation for the local::lib module in CPAN.

Ultimately your goal should be to not install non-packaged software to /usr/local and by doing so increase the maintainability of your systems.