duct tape
Folks used to refer to perl as 'the duct tape of the internet'. It still totally is.
I've started posting perl (and other) portland and/or telecommute jobs on twitter. I thought I'd also include these tweets in the 2pdx.com LinkedIn group. LI supports rss feed inclusion in the news for their groups, so it should simply be a matter of pasting in the rss url
https://twitter.com/statuses/user_timeline/this_job.rss
into their UI. Nope. LI claims that this is not a valid rss feed. Hmm... The validator disagrees, but it does point out some warnings. Maybe LI's code just isn't up to handling that. Even if this was only an issue with twitter's feeds, "just twitter" is a rather large set of rss feeds to exclude based on an overly-strict parser. I advised them of the issue via their feedback form.
In the mean time, I can take a couple of minutes to write perl to grab one internet resource (the twitter feed) and scrub the content enough so that it is palatable to another internet resource (LI). Now I've got a suitable workaround until LI updates their code.
This seemed like a pretty canonical case of being the duct tape for the internet. The code isn't pretty, but it doesn't need to be.
#!/usr/bin/perl -T my $dirty_rss = 'http://twitter.com/statuses/user_timeline/this_job.rss'; my $clean_rss = 'http://wickline.org/bird_bath/'; use strict; use warnings; $| = 1; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); $mech->get( $dirty_rss ); my $feed = $mech->content(); for ( $feed ) { s{xmlns:twitter="[^"]+"}{}gi; s{<twitter:[^\n]+}{}gi; s{\Q$dirty_rss\E}{$clean_rss}gi; } print "Content-type: application/rss+xml; charset=utf-8\n\n$feed\n"; exit;
Actually, the saying is attributed to Hassan Schroeder, Sun's first webmaster.