<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Random and Irrelevant &#187; Perl</title>
	<atom:link href="http://sgp.me.uk/tag/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://sgp.me.uk</link>
	<description>Sam Pearson&#039;s weblog - irrelevant content randomly updated</description>
	<lastBuildDate>Fri, 18 Nov 2011 18:06:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Flickrtweeter: automatically tweet your flickr pics</title>
		<link>http://sgp.me.uk/2009/03/24/flickrtweeter-automatically-tweet-your-flickr-pics/</link>
		<comments>http://sgp.me.uk/2009/03/24/flickrtweeter-automatically-tweet-your-flickr-pics/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 21:39:31 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/?p=579</guid>
		<description><![CDATA[A few weeks ago I decided to roll my own script to automatically twitter an update if I posted a photo onto my flickr pages with a certain tag.  I know that there are third party services out there that can do this for you (e.g. <a href="http://snaptweet.com/">Snaptweet</a>, <a href="http://flickr.twittergram.com/">Twittergram</a>) but I thought it'd be an interesting project to do it myself. <a href="http://sgp.me.uk/2009/03/24/flickrtweeter-automatically-tweet-your-flickr-pics/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I decided to roll my own script to automatically twitter an update if I posted a photo onto my flickr pages with a certain tag.  I know that there are third party services out there that can do this for you (e.g. <a href="http://snaptweet.com/">Snaptweet</a>, <a href="http://flickr.twittergram.com/">Twittergram</a>) but I thought it&#8217;d be an interesting project to do it myself.  As well as (obviously) requiring <a href="http://flickr.com/">flickr</a> and <a href="http://twitter.com/">twitter</a> accounts, it also requires a <a href="http://bit.ly/">bit.ly</a> account and API key as it uses this service to produce a shortened URL for the photo to include in the tweet.</p>
<p>The script is written in Perl and is fairly straitforward.  It pulls <a href="http://api.flickr.com/services/feeds/photos_public.gne?id=86036289@N00&amp;amp;lang=en-us&amp;amp;format=atom">the Atom feed of my flickr account</a> and checks any photos tagged &#8220;twitme&#8221; against a list of photos it has already seen and tweeted.  It then passes the photo&#8217;s URL through bit.ly to get a shortened version and builds a tweet using a standard prefix, the photo&#8217;s title from flickr, and the bit.ly&#8217;ified URL.  It then attempts to post the tweet.</p>
<p>The script uses <code>LWP::Simple</code> for HTTP <code>GET</code>s to flickr and bit.ly, <code>XML::Simple</code> to parse the responses, <code>Storable</code> to maintain a cache file of seen photos, <code>Net::Twitter</code> to talk to twitter itself and <code>URI::Escape</code> to escape the photo&#8217;s URL before passing it to bit.ly.  It also uses the <code>sysopen</code> call from <code>Fcntl</code> to manage a lockfile &#8211; I run it as a cron job so this seemed a sensible precaution.</p>
<p>It can be configured by setting variables at the start of the script.  All are commented (I hope) reasonably clearly.  It can be downloaded and used under the terms of the GNU Public License.  I originally called it flickr2twitter but as this appears to be <a href="https://addons.mozilla.org/en-US/firefox/addon/11212">the name of a Firefox Addon</a> I have renamed it <a href="http://sgp.me.uk/files/flickrtweeter">flickrtweeter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2009/03/24/flickrtweeter-automatically-tweet-your-flickr-pics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic version control with wikieditish</title>
		<link>http://sgp.me.uk/2005/08/05/wikieditish-vc/</link>
		<comments>http://sgp.me.uk/2005/08/05/wikieditish-vc/#comments</comments>
		<pubDate>Fri, 05 Aug 2005 07:55:53 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Blosxom]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2005/08/05/wikieditish-vc</guid>
		<description><![CDATA[At the <a href="http://www.stwerburghs.org.uk/">St Werburghs Community Centre</a>,  we use <a href="http://www.blosxom.com/">Blosxom</a> to power our website.  As the other staff needed to be able to update and add content quickly and with the minimum of fuss, I combined the <a href="http://www.blosxom.com/plugins/edit/wikieditish.htm" rel="related" title="The original wikieditish plugin">wikieditish</a> plugin with <a href="http://tinymce.moxiecode.com/" title="TinyMCE turns textareas into rich-text editing areas">TinyMCE</a> and a couple of other scripts to create a simple rich-text web interface to the site. <a href="http://sgp.me.uk/2005/08/05/wikieditish-vc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>At the <a href="http://www.stwerburghs.org.uk/">St Werburghs Community Centre</a>,  we use <a href="http://www.blosxom.com/">Blosxom</a> to power our website.  As the other staff needed to be able to update and add content quickly and with the minimum of fuss, I combined the <a href="http://www.blosxom.com/plugins/edit/wikieditish.htm" rel="related" title="The original wikieditish plugin">wikieditish</a> plugin with <a href="http://tinymce.moxiecode.com/" title="TinyMCE turns textareas into rich-text editing areas">TinyMCE</a> and a couple of other scripts to create a simple rich-text web interface to the site.</p>
<p>During testing and the initial setup period, it became apparent that having the ability to roll an entry back to its original state after a dodgy edit would be a useful feature, so I added a few lines of code to wikieditish that supports a very simple kind of version control: every time a change is made, the plugin saves a copy of the current state of the post into a backup file.  This file is over-written each time so you can only revert to the last saved version, but this allowed staff some scope for experimentation with the knowledge that they could undo any serious mistakes quickly.</p>
<p>I thought that I&#8217;d make this version of the plugin available here in case any other blosxom users might find it useful, so download <a href="http://sgp.me.uk/files/wikieditishvc.zip" rel="enclosure">wikieditishvc.zip</a>, which contains the plugin and some basic flavour templates.  I have not renamed the plugin itself, it is still simply named wikieditish, but I&#8217;ve added a bit of extra documentation and updated the version number to differentiate it.  The version control behaviour is all optional and is off by default.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2005/08/05/wikieditish-vc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Atom 1.0 Support for Blosxom</title>
		<link>http://sgp.me.uk/2005/08/04/atom-for-blosxom/</link>
		<comments>http://sgp.me.uk/2005/08/04/atom-for-blosxom/#comments</comments>
		<pubDate>Thu, 04 Aug 2005 15:36:12 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[Blosxom]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2005/08/04/atom-for-blosxom</guid>
		<description><![CDATA[Here is an updated atomfeed plugin that supports <a rel="related" href="http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html">Atom 1.0</a>: download <a href="http://sgp.me.uk/files/atomfeed">atomfeed</a> <a href="http://sgp.me.uk/2005/08/04/atom-for-blosxom/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is an updated atomfeed plugin that supports <a rel="related" href="http://atompub.org/2005/07/11/draft-ietf-atompub-format-10.html">Atom 1.0</a>: download <a href="http://sgp.me.uk/files/atomfeed">atomfeed</a>.</p>
<p>Changes since the last beta version:</p>
<ul>
<li>Moved variable configuration to head sub</li>
<li>Added simple entity-unescaping in generation of the <code></code> element</li>
<li>Adjusted the <code>xml:base</code> attribute to reflect <code>$id_domain</code> rather than <code>$blosxom::url</code>, and added the attribute at feed-level as well as for each entry</li>
</ul>
<p>This plugin offers basic support for most of the specification, which should be enough for the vast majority of users.  Not currently supported are the <code></code> and <code></code> elements.  <code></code> has been excluded as it seems an element more aimed at those publishing feeds aggregated from other feeds.  <code></code> probably could be supported, but would have been a bit of a kludge without the use of metadata &#8211; so anyone who needs this element could use the <a href="http://www.blosxom.com/plugins/meta/meta.htm">meta</a> plugin and a custom template.</p>
<p>Of course, Atom is designed to be flexible and extensible and there are already people out there imagining losts of uses for the format &#8211; see <a rel="related" href="http://www-128.ibm.com/developerworks/xml/library/x-atom10.html">this article</a> at <a href="http://www-130.ibm.com/developerworks/">IBM Developer Works</a> for some ideas (via <a rel="via" href="http://www.tbray.org/ongoing/When/200x/2005/07/14/Atom-1.0">Tim Bray</a>).  This plugin can never hope to cater for all possible uses, but it should be enough to provide the bare bones that others can build upon to meet their own needs.</p>
<p>The plugin comes with flavour templates and extensive documentation, including a list of all the variables it makes available for use in templates, notes on compatibility issues with other plugins and suchlike.  I&#8217;ve extracted some of the major points below, but see the plugin itself for more complete notes.</p>
<ul>
<li>The plugin has a large number of configurable variables and generates an even larger number of template variables.  However, it is designed to be usable with only minimal configuration: set the variables <code>$default_author</code> and <code>$feed_yr</code>, drop the plugin into your <code>$plugins_dir</code> and off you go.</li>
<li>The plugin is intended to work with nothing but <code>blosxom.cgi</code> and a standard perl installation, but it will perform better if the <code>XML::Parser</code> and <code>LWP</code> modules are installed, and if you are using a plugin like <a href="http://www.blosxom.com/plugins/indexing/entries_cache.htm">entries_cache</a> that stores the creation times of your posts.</li>
<li>If you are modifying the content of your entries using other plugins, particularly any that escape characters or add markup (like some of <a href="http://www.blosxom.com/plugins/text/index.html">these</a>), you should have them run before the atomfeed plugin.  You want atomfeed to get each post in the state that it would be sent to a normal web browser.</li>
<li>Similarly, if you intend to use the <a href="http://www.blosxom.com/plugins/general/config.htm">config</a> or <a href="http://www.blosxom.com/plugins/general/prefs.htm">prefs</a> plugins to modify any of the variables generated by the plugin, they will need to run before it.</li>
<li>Podcasters: enclosures are supported.  You need to link to your enclosure in the body of your weblog post, and provide the anchor tag with a <code>rel</code> attrubute of &#8220;enclosure&#8221;.  For example: <code>&lt;a rel=&quot;enclosure&quot; href=&quot;http://example.com/podcasts/august-05.mp3&quot;&gt;Podcast for 5th August&lt;/a&gt;</code>.  If you have the <code>LWP</code> module and you change the <code>$use_full_enclosures</code> configurable variable to &#8220;1&#8243;, the plugin will also include data on the length and content type of the enclosure (this is recommended as good practice).</li>
<li>You can include &#8220;related&#8221; and &#8220;via&#8221; links using a similar method &#8211; just ensure the anchor tags have an appropriate <code>rel</code> attribute for these links to be included in your feed as corresponding <code> </code>s.</li>
</ul>
<p>Please post any feedback you have to the <a href="http://groups.yahoo.com/group/blosxom/">blosxom mailing list</a>, maybe as a follow-up to <a href="http://groups.yahoo.com/group/blosxom/message/10858">this post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2005/08/04/atom-for-blosxom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beta support for Atom 1.0 in blosxom</title>
		<link>http://sgp.me.uk/2005/07/20/atom-1-beta/</link>
		<comments>http://sgp.me.uk/2005/07/20/atom-1-beta/#comments</comments>
		<pubDate>Wed, 20 Jul 2005 11:20:36 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[Blosxom]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2005/07/20/atom-1-beta</guid>
		<description><![CDATA[It's finished!  See <a href="http://sgp.me.uk/sam/2005/08/04/atom-for-blosxom" rel="related">this post</a> for more information, docs and download. <a href="http://sgp.me.uk/2005/07/20/atom-1-beta/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3>atomfeed released!</h3>
<p>It&#8217;s finished!  See <a href="http://sgp.me.uk/sam/2005/08/04/atom-for-blosxom" rel="related">this post</a> for more information, docs and download.</p>
<h3>atomfeed-beta-6</h3>
<p>Download: <a href="http://sgp.me.uk/files/atomfeed-beta-6">atomfeed-beta-6</a></p>
<p>This is now pretty much ready for release: just a last check for suggestions and bugs.  It now supports the whole spec apart from <code><source></code>, which seems aimed at aggregators rather than bloggers, and <code><contributor></code>, which could easily be implemented if desired using the <a href="http://www.blosxom.com/plugins/meta/meta.htm" rel="related">meta plugin</a>.</p>
<p>Changes:</p>
<ul>
<li>Moved from using <code>class</code> to <code>rel</code> attributes in HTML anchors to identify enclosure/via/related links to include in the feed.  Just use the appropriate <code>rel</code> value &#8211; there&#8217;s no need to include the &#8220;atom-&#8221; prefix any longer.</li>
<li>Support for <code><br />
<summary></code>.  This uses a technique similar to that used by the <a href="http://www.blosxom.com/plugins/text/foreshortened.htm" rel="related">foreshortened plugin</a>.  It is excluded from the default templates in favour of a full-text <code><content></code> element.  I&#8217;ve temporarily placed the <code><br />
<summary></code> inside a comment in my feed if you&#8217;re interested in how it looks.</li>
<li><code><icon></code> and <code><logo></code> are now available as user-configurable variables.</li>
<li>Documentation is now included in the plugin &#8211; use <code>perldoc</code> or read directly.</li>
<li>Includes support for a stylesheet, like in the original 0.3 version.  Excluded by default.  You can also specify the MIME tpye of the stylesheet.</li>
</ul>
<p>As before, comments to <a href="http://groups.yahoo.com/group/blosxom/">the mailing list</a> please.</p>
<h3>atomfeed-beta-5</h3>
<p>Download <a href="http://sgp.me.uk/files/atomfeed-beta-5">atomfeed-beta-5</a></p>
<p>Changes in this version: support for <code>rel</code> attributes in <code>
<link></code> elements, including enclosures (based on <a href="http://www.evilgeniuschronicles.org/wordpress/">Dave Slusher</a>&#8216;s and <a href="http://www.asyserver.com/~kirwin/">Keith Irwin</a>&#8216;s <a href="http://www.evilgeniuschronicles.org/wordpress/2004/09/23/enclosures-plugin/" rel="related">enclosures plugin</a> for RSS 2).</p>
<ul>
<li>enlcosure: In the body of your post,  link to a file you would like to appear in your atom feed as an enclosure.  Make sure this link has a <code>class</code> attribute of &#8220;atom-enclosure&#8221;.  For extra points: if you have access to the LWP perl module, set the configurable variable <code>$use_full_enclosures</code> to &#8220;1&#8243; and atomfeed will attempt to find the content-type and length of your enclosure.  (Test: <a href="http://sgp.me.uk/files/pop.wav" rel="enclosure">This little audio file</a> should appear in my post as an enclosure.  The code for this link looks like this: <code><a href="http://sgp.me.uk/pop.wav" class="atom-enclosure">This little audio file</a></code>)</li>
<li>via: To include a link from your post in your atom feed as <code>
<link rel="via" ... /></code>, give it a <code>class</code> attribute of &#8220;atom-via&#8221;</li>
<li>related: similar to via, simply give a link a <code>class</code> attribute of &#8220;atom-related&#8221; for it to appear in your atom feed as an appropriate <code>
<link></code> element.</li>
</ul>
<p>Note: using the <code>class</code> attribute to identify these links may change in future versions.</p>
<h3>atomfeed-beta-4</h3>
<p>Download <a href="http://sgp.me.uk/files/atomfeed-beta-4">atomfeed-beta-4</a></p>
<p>Changes in this version (also posted to mailing list) based on suggestions from <a href="http://www.enilnomi.net/">Stu MacKenzie</a>:</p>
<ul>
<li>typo corrected</li>
<li><code>XML::Parser</code> is now a <code>require</code> rather than a <code>use</code> &#8211; those who don&#8217;t have this module can now use the plugin with the consequence that their entries will never be labelled as xhtml, only text or html, regardless of validity/well-formedness.</li>
<li>Regular expression for guessing text vs. mark-up is now: <code>m!</?[a-zA-Z0-9]+&#160;?/?>!</code>  This should hopefully catch pretty much anything that resembles mark-up.</li>
<li>The check in the <code>start()</code> sub for preloaded templates is now <code>or</code>&#8216;d with the call to <code>_load_templates</code>.  I&#8217;m not even sure if this check is necessary, as it doesn&#8217;t appear possible for any user-defined templates to have been loaded by this stage anyway, unless someone else knows better?</li>
</ul>
<h3>Major Revision: atomfeed-beta-3</h3>
<p>Since posting this entry, I have made a number of changes to the plugin.  It now contains support for the following additional elements:</p>
<ul>
<li><uri> and <email> for <author></li>
<li><category></li>
<li><rights></li>
</ul>
<p>Also, it checks <code>$blog_title</code>, <code>$blog_description</code> and each post&#8217;s <code>$title</code> for markup by looking for <del>left-side angle brackets</del> anything matching the regular expression <code>/<[a-zA-Z0-9]+>/</code>.  If it finds a match, it assumes that the variable contains markup and parses it as such, labelling it either html or xhtml depending on well-formedness.</p>
<p>You can <a href="http://sgp.me.uk/files/atomfeed-beta-3">download the new version here</a>.  The link below continues to point to the original version.  Documentation is still not finished, but the code is commented.  I&#8217;m particularly interested in feedback on the <code>_parse_markup</code> subroutine.</p>
<h3>Original post</h3>
<p>I&#8217;ve updated the atomfeed plugin for Blosxom to emit a basic Atom 1.0 feed.  It&#8217;s in beta; you can <a href="http://sgp.me.uk/files/atomfeed-beta">download it here</a>.  I&#8217;m running the plugin, so if you like you can see it in action by checking <a href="http://sgp.me.uk/sam/index.atom">my Atom feed</a>; the feed&#8217;s been checked with <a href="http://feedvalidator.org/">feedvalidator.org</a>&#8216;s new Atom 1.0 support.  Here are the notes I posted to the <a href="http://groups.yahoo.com/group/blosxom/">blosxom mailing list</a>:</p>
<p>The feed is very basic:  only the required elements along with a feed-level <code>
<link rel="self"/></code> pointing at the feed, a <code><subtitle></code> based on <code>$blog_description</code>, a <code><generator></code> element (updated 2005-07-21, but it was always in there), and each <code><entry></code> has a <code>
<published></code> as well as an <code><updated></code> element.</p>
<p>I have not yet updated documentation in the plugin.  I&#8217;m making it available so that anyone interested can take a look and make suggestions before I start looking at adding more support for optional elements and doing some other bugfixes.  When I&#8217;m happy with it I&#8217;ll re-write the docs, remove the BETA flag and post some instructions on my site.  Until then, use these notes as guidance if you want to use or test the plugin:</p>
<ul>
<li><code>$feed_yr</code> is now a configurable variable that MUST to be set to the year you want to see in your feed level <code><id></code> element.  This should be set once and then never changed.</li>
<li><code>
<published></code> is derived from the timestamp in <code>%blosxom::files</code>, and <code><updated></code> (entry level) is derived from a <code>stat()->mtime</code> on the actual file.  For these two elements to work as intended, you really should be running <a href="http://www.blosxom.com/plugins/indexing/entries_cache.htm">entries_cache</a> or similar, otherwise they will be the same.</li>
<li>entry level <code><id></code>&#8216;s are derived from <code>%blosxom::files</code>.  Again, for maximum conformance &#8211; to guarantee the <code><id></code> tags never change &#8211; is currently to use entries_cache or similar.</li>
<li>I decided not to worry about sniffing for plaintext entries as it seems to me that most blosxom users will have markup in their entries, so the mechanism for determining the type of <code><content></code> has remained bascially the same (UPDATED &#8211; see below).</li>
<li>I am still assuming that <code>$blog_title</code> and <code>$blog_description</code> contain only plaintext and no mark-up whatsoever.</li>
<li>the feed-level <code><updated></code> element must appear before the <code><entry></code>s, so I&#8217;ve taken the method used in the <a href="http://www.blosxom.com/plugins/syndication/rss10.htm">rss10</a> plugin to insert it in <code>$blosxom::output</code> in the foot subroutine using a placeholder.</li>
</ul>
<h3 id="u20050721">Update 2005-07-21 (1)</h3>
<p>I&#8217;ve removed the code that conditionally placed some HTML content into a <code>CDATA</code> section.  ALL content identfied as HTML will now be escaped.</p>
<h3>Feedback</h3>
<p>Please direct comments to the <a href="http://groups.yahoo.com/group/blosxom/">blosxom mailing list</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2005/07/20/atom-1-beta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://sgp.me.uk/files/pop.wav" length="4068" type="audio/x-wav" />
		</item>
		<item>
		<title>Hide plugin and date-based URLs</title>
		<link>http://sgp.me.uk/2005/04/17/hide-with-date-urls/</link>
		<comments>http://sgp.me.uk/2005/04/17/hide-with-date-urls/#comments</comments>
		<pubDate>Sun, 17 Apr 2005 09:42:31 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Blosxom]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2005/04/17/hide-with-date-urls</guid>
		<description><![CDATA[The <a href="http://fletcher.freeshell.org/wiki/HidePlugin" title="The Hide plugin homepage">hide</a> plugin allows you to conceal certain posts and/or categories from the standard blosxom index pages - this works for either path or date based <abbr title="Uniform Resource Locator">URL</abbr>s.  A side effect of this is that if you are using date-based links like me - <code>http://example.com/YYYY/MM/DD/filename</code> - then the posts won't show up when you visit their permalinks - they'll only display when referenced with a URL like <code>http://example.com/path/to/filename.flavour</code>. <a href="http://sgp.me.uk/2005/04/17/hide-with-date-urls/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://fletcher.freeshell.org/wiki/HidePlugin" title="The Hide plugin homepage">hide</a> plugin allows you to conceal certain posts and/or categories from the standard blosxom index pages &#8211; this works for either path or date based <abbr title="Uniform Resource Locator">URL</abbr>s.  A side effect of this is that if you are using date-based links like me &#8211; <code>http://example.com/YYYY/MM/DD/filename</code> &#8211; then the posts won&#8217;t show up when you visit their permalinks &#8211; they&#8217;ll only display when referenced with a URL like <code>http://example.com/path/to/filename.flavour</code>.</p>
<p>A solution is to add quick test to the <code>start</code> subroutine in the hide plugin that checks to see whether blosxom knows about any date-based path information:</p>
<pre><code>sub start {
  $blosxom::path_info_yr and return 0;
  ...</code></pre>
<p>As I don&#8217;t want posts in <a href="http://sgp.me.uk/sam/about/">about/</a> to display in the monthly archives, I used the <code>$path_info_da</code> variable, but you could just as easily use <code>$path_info_yr</code> or <code>$path_info_mo</code> instead to allow the posts to display on less specific date-based index pages.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2005/04/17/hide-with-date-urls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stripping out &lt;script&gt; tags from RSS feeds</title>
		<link>http://sgp.me.uk/2005/04/16/strip-script-tags/</link>
		<comments>http://sgp.me.uk/2005/04/16/strip-script-tags/#comments</comments>
		<pubDate>Sat, 16 Apr 2005 15:06:39 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Blosxom]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2005/04/16/strip-script-tags</guid>
		<description><![CDATA[It's good practice not to include <code>&#60;script&#62;</code> tags inside your <abbr title="Really Simple Syndication">RSS</abbr> feeds, and <a href="http://feedvalidator.org/" title="Validate your feeds!">feedvalidator.org</a> will <a href="http://feedvalidator.org/docs/warning/ContainsScript.html" title="foo should not contain script tag">react</a> if you include them, so here's a <a href="http://sgp.me.uk/files/strip_script_tags" title="Download strip_script_tags">plugin</a> that will do this for you. <a href="http://sgp.me.uk/2005/04/16/strip-script-tags/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s good practice not to include <code>&lt;script&gt;</code> tags inside your <abbr title="Really Simple Syndication">RSS</abbr> feeds, and <a href="http://feedvalidator.org/" title="Validate your feeds!">feedvalidator.org</a> will <a href="http://feedvalidator.org/docs/warning/ContainsScript.html" title="foo should not contain script tag">react</a> if you include them, so here&#8217;s a <a href="http://sgp.me.uk/files/strip_script_tags" title="Download strip_script_tags">plugin</a> that will do this for you.</p>
<p>By default, the plugin will attempt to strip <code>&lt;script&gt;</code> tags from the <code>&#036;body</code> of your posts when <code>&#036;blosxom::flavour</code> equals &#8220;rss&#8221;.  This is configurable, of course.</p>
<p>Note that the plugin is not designed as a security precaution and so the regular expression used to try and find the tags isn&#8217;t particularly sophisticated.  It is case-insensitive but expects to find the actual tags themselves to be unbroken by white space or line breaks, however the contents of the tags can be arranged in any way you please.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2005/04/16/strip-script-tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Auto escaping HTML in RSS with blosxom</title>
		<link>http://sgp.me.uk/2005/04/16/auto-escaping-html/</link>
		<comments>http://sgp.me.uk/2005/04/16/auto-escaping-html/#comments</comments>
		<pubDate>Sat, 16 Apr 2005 12:34:17 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Blosxom]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2005/04/16/auto-escaping-html</guid>
		<description><![CDATA[Out of the box, blosxom comes with simple <abbr title="HyperText Markup Language">HTML</abbr> and <abbr title="Really Simple Syndication">RSS</abbr> formats built in.  In order to get the RSS 0.91 feed set-up correctly, blosxom escapes HTML tags during the story generation phase where is finds an <abbr title="eXtensible Markup Language">XML</abbr> content-type (specifically: <code>$content_type =~ m{\Wxml$}</code>). <a href="http://sgp.me.uk/2005/04/16/auto-escaping-html/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Out of the box, blosxom comes with simple <abbr title="HyperText Markup Language">HTML</abbr> and <abbr title="Really Simple Syndication">RSS</abbr> formats built in.  In order to get the RSS 0.91 feed set-up correctly, blosxom escapes HTML tags during the story generation phase where is finds an <abbr title="eXtensible Markup Language">XML</abbr> content-type (specifically: <code>$content_type =~ m{\Wxml$}</code>).</p>
<p>This feature is fine until you start experimenting with your RSS feeds when it can become a bug.  For example, if you decide to provide the full text for each story in a feed enclosed in a <code>CDATA</code> section, you don&#8217;t want this escaping to take place.  So I recommend that you move the escaping section from blosxom itself and place it into a plugin where you can then call it if you need it.</p>
<p>The escaping code is lines 378-384 in the standard blosxom 2.0 script.  Just for fun I&#8217;ve made a <a href="http://sgp.me.uk/files/blosxom-noescape.patch" title="Download blosxom-noescape.patch">patch</a>, but it&#8217;s probably simpler to just open a text editor and do it by hand.  Here&#8217;s a <a href="http://sgp.me.uk/files/escape_html" title="Download escape_html">simple plugin</a> that allows you to control whether or not the code is called during the story generation phase.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2005/04/16/auto-escaping-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Untainting blosxom</title>
		<link>http://sgp.me.uk/2005/03/14/untainting-blosxom/</link>
		<comments>http://sgp.me.uk/2005/03/14/untainting-blosxom/#comments</comments>
		<pubDate>Mon, 14 Mar 2005 16:11:03 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Blosxom]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2005/03/14/untainting-blosxom</guid>
		<description><![CDATA[If you want to run <a href="http://www.blosxom.com/" title="The Blosxom homepage">Blosxom</a> in taint mode (using the <code>-T</code> switch), you'll hit some problems with 2.0 as it comes out of the box.  See below the fold for a patch. <a href="http://sgp.me.uk/2005/03/14/untainting-blosxom/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you want to run <a href="http://www.blosxom.com/" title="The Blosxom homepage">Blosxom</a> in taint mode (using the <code>-T</code> switch), you&#8217;ll hit some problems with 2.0 as it comes out of the box.  <a href="http://www.scalableinformatics.com">Joe Landman</a> posted a patch dealing with one issue on the <a href="http://groups.yahoo.com/group/blosxom/message/10344" title="link to Joe's post and patch">mailing list</a> over the weekend, but if you&#8217;re using any plugins then you&#8217;ll immediately encounter another problem when blosxom does a <code>readdir()</code> on your <code>$plugins_dir</code>.  Here&#8217;s <a href="http://sgp.me.uk/files/untaint.patch" title="untaint.patch">a patch</a> that solves both these issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2005/03/14/untainting-blosxom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>blosxom plugin: altlinks</title>
		<link>http://sgp.me.uk/2004/05/18/altlinks/</link>
		<comments>http://sgp.me.uk/2004/05/18/altlinks/#comments</comments>
		<pubDate>Tue, 18 May 2004 12:49:15 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Blosxom]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2004/05/18/altlinks</guid>
		<description><![CDATA[This is a trivial plugin I wrote to scratch a bit of an itch.  It had always slightly annoyed me that while <a href="http://www.blosxom.com/" title="Visit the blosxom homepage">blosxom</a> itself was designed to use the filesystem hierarchy as its structure and allowed you to view pages based on their position in the hierarchy, there was no simple method to include alternate &#60;link&#62;s to syndication feeds or alternative flavours that mirrored a visitor's position.  Hence <a href="http://sgp.me.uk/files/altlinks">altlinks</a>. <a href="http://sgp.me.uk/2004/05/18/altlinks/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a trivial plugin I wrote to scratch a bit of an itch.  It had always slightly annoyed me that while <a href="http://www.blosxom.com/" title="Visit the blosxom homepage">blosxom</a> itself was designed to use the filesystem hierarchy as its structure and allowed you to view pages based on their position in the hierarchy, there was no simple method to include alternate &lt;link&gt;s to syndication feeds or alternative flavours that mirrored a visitor&#8217;s position.  Hence <a href="http://sgp.me.uk/files/altlinks">altlinks</a>.</p>
<p>Currently, the plugin works for path-based views right the way down to individual story pages, but date-based paths are ignored completely &#8211; the href attribute will be formed from whatever path information is available in the requesed <abbr title="Uniform Resource Locator">URL</abbr>.  That is, if you request <em>http://yourblog.net/path/2003/10</em>, the alternate
<link> will have an href attribute pointing to <em>http://yourblog.net/path/index.flavour</em>.  I originally thought this wouldn&#8217;t matter, but I suppose for the sake of completeness I should I add this at some time.  When I get around to it, I will post an updated version here.</p>
<p>I wasn&#8217;t going to post this code at all, particularly since it&#8217;s not quite finished, but then I thought it might be useful to someone somewhere sometime, so here it is.  The plugin provides three variables for use in templates, allows the user to specify which flavours these variables point to, and contains full documentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2004/05/18/altlinks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transforming &lt;foaf:mbox&gt; to &lt;foaf:mbox_sha1sum&gt;</title>
		<link>http://sgp.me.uk/2004/05/17/sha1sum/</link>
		<comments>http://sgp.me.uk/2004/05/17/sha1sum/#comments</comments>
		<pubDate>Mon, 17 May 2004 11:15:57 +0000</pubDate>
		<dc:creator>Sam</dc:creator>
				<category><![CDATA[Geekery]]></category>
		<category><![CDATA[FOAF]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://sgp.me.uk/2004/05/17/sha1sum</guid>
		<description><![CDATA[Recently I added a number of people into my <acronym title="Friend of a Friend">FOAF</acronym> <a href="http://sgp.me.uk/metadata/foaf.rdf" title="download it here">file</a>.  At first I included their email addresses in plaintext using the <foaf:mbox> property, but I decided that this wasn't really acceptable for several reasons so decided to switch to using the obscured <foaf:mbox_sha1sum> property instead. <a href="http://sgp.me.uk/2004/05/17/sha1sum/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I added a number of people into my <acronym title="Friend of a Friend">FOAF</acronym> <a href="http://sgp.me.uk/files/foaf.rdf" title="download it here">file</a>.  At first I included their email addresses in plaintext using the <foaf:mbox> property, but I decided that this wasn&#8217;t really acceptable for several reasons so decided to switch to using the obscured <foaf:mbox_sha1sum> property instead.</p>
<p>Instead of calculating the <acronym title="Secure Hash Algorithm">SHA</acronym> 1 digests of all the email addresses separately and pasting them into the file, I wrote a simple Perl script to go through it and do it all automatically.  It occurred to me that this might be useful to someone else one day, so <a href="http://sgp.me.uk/files/sha1sum" title="Download the code">here it is</a>.  The script includes some documentation in <acronym title="Plain Old Documentation">POD</acronym> format.</p>
<p>There are snippets of code from various programming languages for creating SHA 1 digests available from <a href="http://www.intertwingly.net/blog/1545.html" title="SHA 1 code snippets">Sam Ruby&#8217;s website</a>, which helped by pointing me towards the module I needed for the program.  For more about FOAF, visit the <a href="http://www.foaf-project.org/" titl="The FOAF Project">FOAF Project website</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://sgp.me.uk/2004/05/17/sha1sum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

