CPAN meets Web 2.0: Tag clouds and Flickr
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
I’m meant to be writing an article for O’Reilly on the topic of CPAN modules for Web 2.0, so I thought I’d mention a couple that I’ve used in my recent website redesign.
If you check out my homepage you’ll see there’s a tag cloud for this blog, as well as a set of photos from Flickr.
The former was done with Leon Brocard’s HTML::TagCloud, a lovely module of exactly the outstanding quality I expect from Leon. No seriously. When you look at a list of tagcloud modules on search.cpan.org and you see one written by Leon, that’s the one you go for. And I’m glad I did, because it was a piece of cake.
The Flickr photos were done using Flickr-Tools by Nuno Filipe Monteiro Nunes. This module was a little harder to get the hang of, and I spent a bit of time buggering around before I got it all working, but it seems to do the trick. There are a couple of other Flickr API modules on CPAN as well; the main contender, Cal Henderson’s Flickr::API, requires more raw requests and reading of the Flickr docs, which might perhaps be more powerful but seemed like a nuisance from where I was sitting.
I’ve included source code to the two Mason components I’m using to show my tagcloud and Flickr photos. As you can see, they’re pretty basic — the Flickr one should almost certainly have some way of dealing with a failed connection — but they do the job for now.
(If you don’t know Mason: basically the stuff in the <%init> tags is run at the start, and does all the setup. Then the stuff outside of that block is what’s actually displayed. Anything else you see with percent signs is basically interpreted as Perl. Having written these components, you can then include them from within another file: in my case, my index.mhtml file.)









No Comments Yet