|
Installing an RSS feed under the gun
|
Social links
Class::Prototype
WWW::Spyder Javascript tricks serial() join function Smart quotes Text to Excel Developing Featherweight Web Services with JavaScript
Miscellaneous
|
|
| Installing an RSS feed... |
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.
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.
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. 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. |
|
|
Perl Books ·
CPAN ·
mod_perl ·
Perl Monks ·
Perl Mongers ·
Perl Journal ·
Use Perl ·
Perl Jobs ·
ActiveState ·
perldoc.perl.org ·
O’Reilly Perl ·
W3Schools tutorials ·
Ovid's CGI Course ·
Catalyst ·
Perl at Wikipedia
Text, original code, fonts, and graphics ©1990-2009 Ashley Pond V. |
||