MetaCPAN FTW!

December 16th, 2010
PerlCPANMetaCPANCPAN-APIGalugaWWW::Widget

Right now, Galuga has a widget that lists my CPAN distributions. But it’s a boring old static affair that is updated manually. Surely in this age of the Web 2.0, I can do better than that.

My first instinct that to go straight for my CPAN author page and extract the information off the HTML:

from_search_cpan.pl

Not too painful, all in all. Mind you, it’d be nicer not to have to fiddle with HTML tables, but short of having a bona fide API…

And that’s when Olaf’s blog reminds me of search.metacpan.org and the CPAN-API project. After a few minutes of peering at what they have to offer, the code above got simplified to:

from_metacpan.pl

Sweet, isn’t?

(The code for both variants of the widget is available at my WWW-Widget GitHub repo.)