# 2011-10-07 Oddmuse, Venus and Perl

Last edit

Summary: I’ve been working on a submission form for the Old School RPG Planet. The planet uses Planet Venus to collect the RSS and Atom feeds of many of the Old School RPG blogs out there. Planet Venus allows you to get the list of feeds via an URL. I’m hosting the list of feeds on Campaign Wiki itself.

Changed:

< ([http://campaignwiki.org/wiki/Planet/raw/Feeds raw format]).

to

> ([http://campaignwiki.org/wiki/Planet/raw/Feeds raw format]). As you can see, it the format doesn't look nice.

Changed:

< * It extracts the title of the feed and adds it to the wiki page.

to

> * It extracts the title of the feed and adds it to the wiki page, sorting all the entries alphabetically.

I’ve been working on a submission form for the Old School RPG Planet. Today I added another little feature. This is how I like to develop code. No time pressure. One little step at a time. Keep polishing it.

The planet uses Planet Venus to collect the RSS and Atom feeds of many of the Old School RPG blogs out there. Planet Venus allows you to get the list of feeds via an URL. I’m hosting the list of feeds on Campaign Wiki itself (raw format). As you can see, it the format doesn’t look nice.

The thing I did, therefore, was to write a script that makes it easy for people who are not into the technical details to submit new blogs. It also makes it easier for me to submit new blogs!

The things it handles:

• If you submit an invalid URL, it will prepend http:// and try again.
• If it looks like we already have a similar looking feed on our page, it requires a confirmation by the user.
• If you submit a web page, it will look for alternative links with MIME types application/rss+xml, application/atom+xml, application/xml (yeah) and text/xml (just making sure) and allow the user to pick one of them.
• If you submitted a feed directly instead of a web page, it it uses that instead.
• If the feed you picked is served with an invalid content type, it is rejected.
• It extracts the title of the feed and adds it to the wiki page, sorting all the entries alphabetically.

I think it’s pretty cool.

If you look at the interface, you’ll note that it has a link to its own source code. I love this little Perl trick:

1. Add __DATA__ at the end of the source file. Usually you would add actual data at the end. The script could read it using the DATA file handle.
2. Serve source code using seek DATA, 0, 0; print "Content-type: text/plain; charset=UTF-8\r\n\r\n", <DATA>; This resets the current position of the DATA file handle to the beginning of the source file. Tadaa!

Tags: