This section, which shows how to make tag clouds in Perl, is followed by a section that covers the same material, but uses PHP. If you are more familiar with PHP, I suggest you skip ahead to the PHP section.
Now I'll show you how to make a Flickr-style tag cloud in Perl. In order to run these scripts, you'll need the following four CPAN modules installed on your system:
LWP::Simple, which provides a
get() function that
retrieves the contents of a web page and stores it in a text string.
HTTP::Cache::Transparent, which provides a caching mechanism that speeds up your scripts (the second time you run them) and reduces the load on servers that you are querying for tags.
XML::RSSLite, which is an RSS parser—one of many such parsers on CPAN. We'll use it to parse the RSS feed at del.icio.us. I chose RSSLite because code that uses it is relatively easy to read, compared to some other parsers. However, if you already prefer another parser, then by all means use it.
Data::Dumper, which produces a Perl listing of any Perl data structure. I use it all the time to save data to files for later use. It is also incredibly helpful for examining and understanding the contents of complex data structures (such as XML trees and the data returned by RSS parsers).
There are three key steps to making a tag cloud:
Most of this article is concerned with the last two tasks: collecting tags and displaying them in the form of a tag cloud. ...