Contributing [to CPAN] is easy!

The following article is a repost of an original that I wrote for blogs.perl.org.

I thought I would share my experience of submitting a module to CPAN for the first time. In summary: it’s stupidly easy and if I can do it, so can you.

I’m not the best Perl coder and therefore I rely heavily on CPAN modules to do the real work. Every now and again I stumble upon bugs, many of which are simple to fix after a little debugging. However, some modules aren’t heavily maintained and some haven’t been touched in years. Bugs that are filed on RT can go unanswered, gathering digital dust while your development machine is riddled with heavily modified modules.

The solution? In my case it was as easy as discussing a few changes with the module author, who added me as a co-maintainer. That allows me to upload new versions, fix tickets in the bug queue and probably many other things I’ve not discovered.

Uploading a new module requires logging into PAUSE and pointing it at a file on your local disk or a remote HTTP server. A few emails later and a short wait and the changes appear on the CPAN website itself.

Some useful things to consider when uploading a new module:

  • Does it still build? Run make clean (or make realclean) and check from scratch!
  • If applicable, do the changes break any tests (run make test)
  • Is the MANIFEST file up to date?
  • Bump the version number in all files that use it (the .pm itself, README, META.yml etc) - grep is your friend here
  • Document what is new in the Changes file
  • Remove any other files left over from your development, then tar it all up
  • Go and resolve bugs on rt.cpan.org that you have fixed and take some credit!

(I’m sure I have missed some important ones, please add them below!)

I noticed when replying to a bug ticket that there is a “minutes spent” field. In all honesty, the above probably took no longer than 10. And that’s how long it takes to have the whole Perl community benefit from your newly broken nicely updated module.

As another quick plug: this is also my first blog post to blogs.perl.org. It was also stupidly easy so if you don’t fancy coding, get scribbling instead!

David Cannings
David Cannings
Cyber Security

My interests include computer security, digital electronics and writing tools to help analysis of cyber attacks.