Discovering Ubuntu Package Names For Perl Modules

Differences in Linux distributions can cause trouble installing dependency packages for Perl modules. Many times you’ll find references to YUM packages which work in Linux builds such as CentOS, but don’t work in Ubuntu.

But there is an easy solution… I came across a nice trick here which explains how to use the online Debian repository to search for package names relating to a particular Perl module.

Basically you take the name of the Perl module you are trying to install support for, split it into path parts then add “.pm” to the end. Take this “file name” and append it to http://packages.debian.org/file: to get a list of package names. Usually the correct package for Ubuntu is the first or one of them.

For example, I was trying to install the Ubuntu equivalent Perl support libraries for “XML::LibXML” and “XML::LibXSLT”. On CentOS I already know the YUM packages are called “perl-XML-LibXML” and “perl-XML-LibXSLT”, but they just don’t exist on Ubuntu with APT-GET. So I did this:

  1. Convert “XML::LibXML” to “XML/LibXML.pm” and request http://packages.debian.org/file:XML/LibXML.pm in a browser. The first result points to “libxml-libxml-perl” as being the correct package. It works with “apt-get libxml-libxml-perl”, hooray!
  2. Do the same with “XML::LibXSLT” and find “libxml-libxslt-perl”, lovely!

If you have single part module names, that’s fine. For example YAML converts to http://packages.debian.org/file:YAML.pm giving “libyaml-libyaml-perl” as a result.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s