Contributing to a Perl module on CPAN (using vim and Github)

In this screencast I am showing how easy it is to contribute a little improvement to a Perl module on CPAN.

I picked the MIME::Lite distribution as it had the annoying habit to ask me if I want to add optional dependencies even when they were already installed on my system. It even asked me if I want to install File::Basename which is a standard module.

The path of action was:

Search on MetaCPAN and locate MIME::Lite to see where the source code lives. This module does not provide the information in its META file nor in its documentation. (BTW I saw that it was already added in the not-yet-released version).

In this case I was lucky as I knew Ricardo (RJBS) uses Github so I went to his Github page and looked for the module. I found the repository of MIME::Lite and forked it by pressing the fork button.

Then I cloned my version of MIME::Lite to my disk using


   $ git clone git@github.com:szabgab/mime-lite.git

Had an editing session using vim. In which I made some refactoring of the code and changed it so it will first check if the optional modules are already installed or not. If they are installed the version number is also checked if it is smaller than the required optional version number.

Once this was fixed I added back the changed file and committed it to my local Git repository:


  $ git add Makefile.PL
  $ git ci -m'make optional modules optional'

Then pushed it to my remote repository on Github.


  $ git push

Then went back to my version of MIME::Lite and clicked on the Pull Request button to send a message to Ricardo asking him to integrate the change.

That's it. A very small improvement to CPAN in 16 minutes.

How do you add optional dependencies? How do you make little contributions?

Published on 2011-07-15 by Gabor Szabo

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
blog comments powered by Disqus


Google Plus Twitter RSS feed