NB: These pages were mostly written in 2001 or so. The résumé dates are accurate but the code is aged and unlike whiskey, 8 year-old code doesn't usually taste better. For a look at my current skills and to see my CPAN modules, sample code, and code discussions, please see these pages instead: Perl resources and sample code and PangyreSoft.
Installing an RSS feed under the gun
Social links
View Ashley Pond V's profile on LinkedIn
Miscellaneous

Other pages

Quick, we need an RSS feed!

Reading through my search referrals I found an interesting site: The Devil’s Dictionary (2.0). It turned up on my site because of its similarity to my own Devil’s Dictionary X™.

A visit proved it quite amusing so I wrote the chief author to congratulate him and pass along my link. He responded and, being a lazy hacker, like all the best, he suggested I add an RSS feed to my dictionary to save him the effort of clicking through it.

It was a really good idea which I’d had before but never got around to doing. So let’s do it together to demonstrate how quickly or slowly I can put something new together with Perl.

Start the clock

First, I don’t really know what RSS literally is beyond being some kind of simplified data feed. Google time. We find http://blogs.law.harvard.edu/tech/rss and it tells us–

RSS is a Web content syndication format. Its name is an acronym for Really Simple Syndication.

Now turn to Perl so we don’t have to think too much more about it.

A search on search.cpan.org for RSS finds XML::RSS, #2 on the list, is described thusly, “creates and updates RSS files.”

Sounds right. So we install it. sudo perl -MCPAN -e shell followed with install XML::RSS and a minute goes by. We’re in business.

Now peruse its POD. Thankfully our good friends Jonathan Eisenzopf and Rael Dornfest have provided us with a good document. Some modules have POD that is frustratingly terse or devoid of sample code. perldoc XML::RSS starts out…

So, our first stab

No trouble. Now some of the sample code from XML::RSS is easy to understand but the meaning of “dc” and “syn” aren’t obvious. Scanning through we find they are short for “Dublin Core” and “syndication.” Seem to be specification sets. We probably want to at least add the “syn,” so we have a bit more code to write. The POD points us to http://purl.org/rss/1.0/modules/syndication to find the syndication specifications.

Looks easy, we have only three elements to add to that branch of the XML. updatePeriod, updateFrequency, and updateBase (date in format: yyyy-mm-ddThh:mm). A quick check shows that since we’re doing “daily” for updatePeriod and only 1x day, we can omit updateFrequency. So we only have two things to add to get the “syn” in.

We would probably like to add our “taxo” (taxonomy) too. Since the Devil’s Dictionary X™ has been listed in the DMOZ (http://dmoz.org/) for 10 years, we already have our taxonomy without needing to look it up: http://dmoz.org/Recreation/Humor/Wordplay/ which is also in Google as http://directory.google.com/Top/Recreation/Humor/Wordplay/

We’ll toss in /Satire too for good measure.

Take 2, flushed all the way out
Run it
G4:jinx[186]~/>ddx-rss-sample-maker
Adding stock market to the RSS feed.
Adding shame to the RSS feed.
Done!
Resulting RSS XML file

Is it soup yet?

Since I’ve never done this or looked at RSS, I don’t know if we’re done or not. Or if what we’ve done is even functional. Time to get an RSS reader and check. Users at http://versiontracker.com/ recommend NetNewsWire Lite; it’s freeware. Install it, fire it up, subscribe to our URL: http://sedition.com/ddx/sample.rss

Open up and it works! We’re done! With version 0.01 anyway. The docs show that there is a 2.0 spec for RSS now and there are many other meta fields we might need to know about or should have in there. So, more research is in order before we commit it to a production crontab, but for our purposes, we’re done.

Checkered flag says

Time from start to finish — not counting writing it up here — to set up an RSS feed was 23 minutes. As is often the case with Perl code, documenting it here took longer than writing the code itself.

Update: I didn’t find it until after tweaking my feed a bit but there is an RSS validator online. Discovered via NetNewsWire Lite. You can also validate your own feed here, or revalidate the DDX feed.

Search these pages via Google
Text, original code, fonts, and graphics ©1990-2009 Ashley Pond V.