Before I go into any modules, I think I should explain what I am doing and why I am doing it. And although I am sure that this is done elsewhere and I am not a fan of reinventing the wheel, I am a fan of making my own life easier and hopefully other’s lives as well.
I often find myself using / reusing the same modules for small scripts. Either they are Perl one-liners or very short scripts to accomplish a semi-common task. Rather than going through and figuring out how I used the module so effectively in the previous instance, I have resorted to storing examples of how I implement various modules in my local CVS repository. Although the whole versioning and tagging system allows me the flexibility of using more than 1 example per module, it is also somewhat restrictive in its ability to allow for search (unless you checkout the whole repository and grep or other overkill or tedious methods).
Then I decided that a good way to do this would be to use a blog. This is the method I chose for a few reasons.
- Central Location
- Everyone Else
I can easily search for the module I want to use taking advantage of either Google‘s index of my site (or another search engine or blog search engine). I can also easily search it using the internal searching methods of the blog.
As I said before…although I am sure that there are other places that do this (including the POD source of many modules and CPAN), I want a central location with easy to understand code.
There are many other’s out there who sometimes don’t understand the code in the POD or in some other code examples. Even larger code repositories and search engines like Krugle are still a little kludgey for basic examples. This also allows for people to contribute if they so desire.
And another great thing about this is that if I get a lot of examples in here, then search engine sites and code repositories will index it and it will be useful to more than just a select few elite who read this blog.
The general rule of this for me is to explain a little about the module, give an example or two from real life, and provide some useful comments to help explain what the code is doing. Since I don’t plan on re-inventing the wheel (as stated more than a few times), I may just copy and paste from the module author (giving credit where credit is due of course). I encourage anyone with simple enough code to provide examples at any point as well. Enjoy.