Best practice for releasing Perl modules to staging and live

Minty mintywalker at
Tue May 19 13:21:53 BST 2009

On Tue, May 19, 2009 at 12:52 PM, Minty <mintywalker at> wrote:
> I use dpkg-buildpackage

For the record, here's my steps for building a new module from
scratch.  Aka, creating a deb for a cpan module that doesn't already
exist.  It isn't the same as building a deb for a module that exists
already as a .deb and which you want a newer CPAN version.

I don't claim to be an expert, or that these are good/right
approaches, but they work for me (and took a lot of figuring out).
They skip over steps that would be required to upload to an official
debian/ubuntu repo, but they generate debs that can be installed with
"dpkg -i", or in my case, uploaded to a local apt repo, from where I
then install them via "apt[itude] install"

Using CPAN::Mini::Webserver here as an example is a bit evil, as it
has a lot of dependencies that aren't in debian/ubuntu by default,
you've been warned ;)  C::M::W is most worth it once you've jumped
through all the hoops tho.

Caveats aside ...

# Ensure minicpan is installed
# see also
# Or, replace the next two steps with (a) find on (b)
download the tarball

# Find the package/dist for the module you're after
/bin/zgrep "CPAN::Mini::Webserver" ~/.MINICPAN/modules/02packages.details.txt

# Unpack it
/bin/tar zxvf ~/.MINICPAN/authors/id/L/LB/LBROCARD/CPAN-Mini-Webserver-0.45.tar.gz

# Rename and duplicate it
/bin/mv CPAN-Mini-Webserver-0.45 libcpan-mini-webserver-perl-0.45
/bin/cp -ai libcpan-mini-webserver-perl-0.45
/bin/cp -ai libcpan-mini-webserver-perl-0.45

# dpkg-buildpackage wants the first two dirs, and (my wrapper script)
# creates the latter for me to poke around and play in.
# Namely...  check it's not going to crash and burn when we try to build the deb
cd libcpan-mini-webserver-perl-0.45.test && perl Makefile.PL && make
&& make test

This step normally reveals any issues.  Lather, rinse repeat the above
until you've got all the dependencies or issues resolved.  Doing this
for CPAN Mini Webserver was what motivated me to create my own wrapper
script for all this, as I found myself lathering, rinsing and
repeating a lot.

# from the dir that *contains* libcpan-mini-webserver-perl*
# magic all the debian meta files into existance
/usr/bin/dh-make-perl libcpan-mini-webserver-perl-0.45

# Edit the change log
vi libcpan-mini-webserver-perl-0.45/debian/changelog

I use a template similar to this (between, not including the ------- lines)
libcpan-mini-webserver-perl (0.45-1~0minty) jaunty; urgency=low

  * Initial Release built from cpan bundle

 -- Minty <mintywalker at>  Tue, 19 May 2009 11:57:15 +0000

# Now build your .deb
cd libcpan-mini-webserver-perl-0.45
dpkg-buildpackage -rfakeroot -sa

All being well, you should now have a .deb file in the parent dir.
You can dpkg -i foo.deb to install this, or setup your own apt repo
(another world of loads of docs, all slightly inconsistent and a lot
of TIMTOWTDI setups from which you need to cherry pick what you want
for your setup).

More information about the mailing list