<?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>patspam.com</title>
	<atom:link href="http://blog.patspam.com/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.patspam.com</link>
	<description>patspampatspampatspampatspam</description>
	<lastBuildDate>Mon, 08 Mar 2010 01:23:45 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PerlSharedHosting</title>
		<link>http://blog.patspam.com/2010/perlsharedhosting</link>
		<comments>http://blog.patspam.com/2010/perlsharedhosting#comments</comments>
		<pubDate>Mon, 08 Mar 2010 01:23:45 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Comp]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1327</guid>
		<description><![CDATA[Latest Web::Simple master (git://git.shadowcat.co.uk/catagits/Web-Simple.git) is now using Plack, the perl web server directly for CGI and FastCGI and I hope do do another release shortly with notes on deploying as both on shared hosts (more specifically Dreamhost but with an invitation to bitch if they don&#8217;t work on other budget hosts).
mst,  &#8221;Oh Subdispatch, Oh Subdispatch&#8220;

Every time someone [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Latest Web::Simple master (git://git.shadowcat.co.uk/catagits/Web-Simple.git) is now using <a href="http://plackperl.org/">Plack, the perl web server</a> directly for CGI and FastCGI and I hope do do another release shortly with notes on deploying as both on shared hosts (more specifically <a href="http://www.dreamhost.com/">Dreamhost</a> but with an invitation to bitch if they don&#8217;t work on other budget hosts).</p>
<p style="text-align: right;">mst,  &#8221;<a href="http://www.shadowcat.co.uk/blog/matt-s-trout/oh-subdispatch-oh-subdispatch/">Oh Subdispatch, Oh Subdispatch</a>&#8220;</p>
</blockquote>
<p style="text-align: left;">Every time someone mentions a cool new web framework like <a href="http://search.cpan.org/perldoc?Web::Simple">Web::Simple</a>, <a href="http://perldancer.org/">Dancer</a> or <a href="http://search.cpan.org/perldoc?Tatsumaki">Tatsumaki</a>, my immediate reaction is to start thinking up cool little niche web apps I could build with it. You know, the kind you imagine yourself whipping up during your lunch break, that will probably never get more than 10 curious users but just might turn into the next big thing if only you got it up and running on a public server. And that&#8217;s when the second thought immediately arrives: where am I going to run this thing? Do I really think the idea has enough legs to justify paying for a virtual server plan? Can I be bothered going through the pain of figuring out how to deploy it on a shared hosting provider? And normally that&#8217;s the point where I sigh wistfully and go back to reading my RSS feeds.</p>
<p style="text-align: left;">The thing is, with the advent of things like <a href="http://search.cpan.org/perldoc?local::lib">local::lib</a> it&#8217;s getting a lot easier to deploy Perl web apps on shared hosting. And with most web frameworks adopting <a href="http://plackperl.org/">Plack/PSGI</a>, the work required to deploy Perl web apps on budget hosts is converging into a similar sequence of steps.</p>
<p style="text-align: left;">So this time during my lunch break I started envisaging a centralised, SEO-friendly information source (hello <a href="http://perlsharedhosting.com">perlsharedhosting.com</a>) that cobbles together all of the currently available information into an easy to digest form to make it ridiculously easy to choose a shared hosting provider, deploy your web app and troubleshoot common problems.</p>
<p style="text-align: left;">A site that works like this:</p>
<ul>
<li>The front page contains a list of Perl-friendly hosting providers, with a meta-score based on how many features they support (+) and how many unresolved issues they have (-), and maybe user review scores thrown into the mix too</li>
<li>Each hosting provider has a page of its own, listing in full which features are supported (used to compute the meta-score). Users can post comments on each of these pages, to leave testimonials (&#8220;I am currently running a Web::Simple site that gets x hits per hour on this host&#8221;) and note unresolved issues (&#8220;module X::Y fails to install on this host&#8221;). As issues get solved these become tips.</li>
<li>Each technology/feature/technique also gets a page of its own, with links to the official man pages, shared-hosting specific notes and again user comments
<ul>
<li>dependency related: <a href="http://search.cpan.org/perldoc?local::lib">local::lib</a>, cpan, <a href="http://search.cpan.org/perldoc?App::cpanminus">cpanm</a>, ..</li>
<li>environment related: locating and running perl, paths, daemons, viewing error output, ..</li>
<li>web deployment related: CGI, FastCGI, ..</li>
<li>framework / web app related: <a href="http://search.cpan.org/perldoc?Web::Simple">Web::Simple</a>, <a href="http://perldancer.org/">Dancer</a>, <a href="http://mojomojo.org/">MojoMojo</a>, <a href="http://www.catalystframework.org/">Catalyst</a>, <a href="http://search.cpan.org/perldoc?Tatsumaki">Tatsumaki</a>, ..</li>
</ul>
</li>
</ul>
<p>I haven&#8217;t decided yet what engine would fit best.. <a href="http://mojomojo.org/">MojoMojo</a> is a front-runner, and in fact the <a href="http://wiki.catalystframework.org/wiki/hosting">Catalyst Friendly Hosting</a> page runs on <a href="http://mojomojo.org/">MojoMojo</a> does a large chunk of what I&#8217;ve described above.</p>
<p>The site would be very &#8220;cookbook&#8221; oriented, since we&#8217;re specifically targeting people who can&#8217;t be bothered learning the ins and outs of 10 different technologies (not to mention figuring out how to get them to play nicely together) for the sake of deploying toy web applications on cheap shared hosting. Just the essentials: this is what you need, this is how you achieve it. And if you want to learn more, go here.</p>
<p>With that in place, we&#8217;d end up with a single, visible, place to research and document the complications of running Perl web apps on shared hosting. And if the site became popular, hosting providers might even take notice and start offering more Perl-friendly shared environments. We could have live demo pages running on different hosts, possibly even donated by hosting providers if they see it as a way of showcasing their Perl-friendliness (mojomojo.dreamhost.perlsharedhosting.com, dancer.resellerzoom.perlsharedhosting.com, etc..).</p>
<p>I got as far as registering the <a href="http://perlsharedhosting.com">domain name</a>; I was planning on getting a simple <a href="http://mojomojo.org/">MojoMojo</a> prototype up and running, but I got side-tracked researching how to deploy it on my shared hosting account&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2010/perlsharedhosting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Padre::Plugin::Plack</title>
		<link>http://blog.patspam.com/2009/padrepluginplack</link>
		<comments>http://blog.patspam.com/2009/padrepluginplack#comments</comments>
		<pubDate>Wed, 23 Dec 2009 15:22:42 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Comp]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1301</guid>
		<description><![CDATA[In conjunction with today&#8217;s Christmas release of Padre, I&#8217;d like to announce my latest Padre plugin: Padre::Plugin::Plack.
As the name suggests, Padre::Plugin::Plack adds Plack awareness to Padre. With the plugin installed, opening *.psgi files causes some special things to happen. PSGI files are really just ordinary Perl files, so Padre does its normal Perl lexing/syntax highlighting magic [...]]]></description>
			<content:encoded><![CDATA[<p>In conjunction with today&#8217;s <a href="http://mail.perlide.org/pipermail/padre-dev/2009-December/001451.html">Christmas release</a> of <a href="http://padre.perlide.org">Padre</a>, I&#8217;d like to announce my latest Padre plugin: <a href="http://search.cpan.org/search?query=Padre::Plugin::Plack">Padre::Plugin::Plack</a>.</p>
<p>As the name suggests, Padre::Plugin::Plack adds <a href="http://plackperl.org">Plack</a> awareness to Padre. With the plugin installed, opening *.psgi files causes some special things to happen. PSGI files are really just ordinary Perl files, so Padre does its normal Perl lexing/syntax highlighting magic on them, but the real fun starts with the Plack-specific features that appear in the per-file graphical <a href="http://search.cpan.org/search?query=plackup">plackup</a> control panel that shows up. The panel lets you run your web app in a Plack server at the click of a button, view server output, configure plackup options and launch a web browser on the appropriate port.</p>
<div><a href="http://blog.patspam.com/wp-content/uploads/2009/12/1.png"><img class="aligncenter size-medium wp-image-1304" title="Padre::Plugin::Plack panel" src="http://blog.patspam.com/wp-content/uploads/2009/12/1-300x142.png" alt="" width="300" height="142" /></a></div>
<p>The great thing about Plack/<a href="http://search.cpan.org/search?query=psgi">PSGI</a> is that unlike my <a href="http://blog.patspam.com/2009/padrepluginwebgui">previous</a> plugin (<a href="http://search.cpan.org/search?query=Padre::Plugin::WebGUI">Padre::Plugin::WebGUI</a>) which was specific to a single web app (albeit a <a href="http://webgui.org">big one</a>), this plugin can be used for any web app built in a <a href="http://plackperl.org/#frameworks">web framework that supports Plack</a> (<a href="http://www.catalystframework.org/">Catalyst</a>, <a href="http://cgi-app.org/">CGI::Application</a>, <a href="http://search.cpan.org/dist/HTTP-Engine">HTTP::Engine</a>, etc..). This potential for cross-framework application is one of the motivating factors that makes developing Plack modules (<a href="http://plackperl.org/#middlewares">Middleware</a> etc..) so much fun.</p>
<p>The plugin turns on plackup&#8217;s &#8220;&#8211;reload&#8221; option by default, which conveniently causes the plack server to reload every time you modify your source files in Padre. This makes for quite a nice, if somewhat minimal &#8220;Plack IDE&#8221; experience (this is version 0.01 after all).</p>
<p>The plugin integrates all of the Plack example &#8220;dot-psgi&#8221; files as templates that can be used to create different types of Plack apps straight from the GUI menu.</p>
<div><a href="http://blog.patspam.com/wp-content/uploads/2009/12/2.png"><img class="aligncenter size-medium wp-image-1305" title="Padre::Plugin::Plack new file templates" src="http://blog.patspam.com/wp-content/uploads/2009/12/2-300x214.png" alt="" width="300" height="214" /></a></div>
<p>The pre-populated list of Plack servers and the simple start/stop button makes for a nice way of exploring the Plack server ecosystem. You can use the other panel options to enter a specific port to run on, toggle auto-start mode and pass additional options to plackup (options that start with &#8220;&#8211;&#8221; are passed through to the backend server).</p>
<div><a href="http://blog.patspam.com/wp-content/uploads/2009/12/3.png"><img class="aligncenter size-medium wp-image-1306" title="Padre::Plugin::Plack server options" src="http://blog.patspam.com/wp-content/uploads/2009/12/3-300x227.png" alt="" width="300" height="227" /></a></div>
<p>The output panel is similar to the output panel that Padre normally displays when you execute Perl files, except that you get one panel per .psgi file meaning that you can run multiple plack servers simultaneously and independently view their output. The appropriate panel is automatically selected when you click on the corresponding file tab, and running processes are stopped when you close the tab.</p>
<p>It should be really easy to turn Padre::Plugin::Plack into new plugins that involve the same basic ingredients, namely  a file extension and an external command for running those files, with a per-file panel for command options and output. So I encourage anyone who has a similar plugin in mind to steal liberally from Padre::Plugin::Plack (as I did from Padre::Plugin::Catalyst &#8211; thanks garu++). Ruby Rack support comes to mind as a trivial example.</p>
<p>Make Padre your domain-specific IDE today <img src='http://blog.patspam.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/padrepluginplack/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plack helps with Javascript development too</title>
		<link>http://blog.patspam.com/2009/plack-helps-with-javascript-development-too</link>
		<comments>http://blog.patspam.com/2009/plack-helps-with-javascript-development-too#comments</comments>
		<pubDate>Fri, 18 Dec 2009 19:23:36 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Comp]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1291</guid>
		<description><![CDATA[Today I was debugging a Javascript bug in ExtJS + AIR, and I wanted to check rendering in another browser. I created a static html file with the minimal javascript test case embedded in it, but then realised that I needed to load in the ExtJS files from somewhere. With other JS libraries you can [...]]]></description>
			<content:encoded><![CDATA[<p>Today I was debugging a Javascript bug in ExtJS + AIR, and I wanted to check rendering in another browser. I created a static html file with the minimal javascript test case embedded in it, but then realised that I needed to load in the ExtJS files from somewhere. With other JS libraries you can use <a href="http://code.google.com/apis/ajaxlibs/">freely available CDNs</a> for this sort of thing, but because ExtJS has funky ideas about licensing, this isn&#8217;t an option. What I needed was a quick and easy way to serve up the ExtJS files, which were sitting in a folder on my computer, over http. This sort of thing happens frequently with custom code too, when you attempt to create a static (minimal test case) version of a live site.</p>
<p>Plack has a really neat solution to this problem.</p>
<p>Following a tip from <a href="http://advent.plackperl.org/2009/12/day-5-run-a-static-file-web-server-with-plack.html">day #5 of Miyagawa&#8217;s Plack advent calendar</a>, serving up the current directory over http is as simple as this Perl one-liner:</p>
<pre class="brush: bash;">

$ plackup -MPlack::App::Directory -e 'Plack::App::Directory-&gt;new

Plack::Server::Standalone: Accepting connections at http://0:5000/
</pre>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 91px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">$ plackup -MPlack::App::Directory -e &#8216;Plack::App::Directory-&gt;new&#8217;Plack::Server::Standalone: Accepting connections at http://0:5000/$ plackup -MPlack::App::Directory -e &#8216;Plack::App::Directory-&gt;new&#8217;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 91px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Plack::Server::Standalone: Accepting connections at http://0:5000/</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 91px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"># Or if you need the files over port 80:</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 91px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">$ sudo plackup -MPlack::App::Directory -e &#8216;Plack::App::Directory-&gt;new&#8217; -p 80</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 91px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Plack::Server::Standalone: Accepting connections at http://0:80/</div>
<p>Or if you need the files served over port 80:</p>
<pre class="brush: bash;">

$ sudo plackup -MPlack::App::Directory -e 'Plack::App::Directory-&gt;new' -p 80

Plack::Server::Standalone: Accepting connections at http://0:80/
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/plack-helps-with-javascript-development-too/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tarpo now on GitHub</title>
		<link>http://blog.patspam.com/2009/tarpo-now-on-github</link>
		<comments>http://blog.patspam.com/2009/tarpo-now-on-github#comments</comments>
		<pubDate>Mon, 30 Nov 2009 01:57:41 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Air]]></category>
		<category><![CDATA[Comp]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1277</guid>
		<description><![CDATA[
At about 11pm on the night before I headed off for the States, Ted the Vet and I sat down to talk Tarpo.
In case you&#8217;re wondering, Tarpo is an open source, cross platform Data Management desktop application for Dog Health programs in rural and remote Indigenous Australian communities, written entirely in Javascript.
The last time I [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;"><a href="http://blog.patspam.com/wp-content/uploads/2009/11/tarpo.jpg"><img class="aligncenter size-medium wp-image-1279" title="Tarpo Logo" src="http://blog.patspam.com/wp-content/uploads/2009/11/tarpo-267x300.jpg" alt="Tarpo Logo" width="267" height="300" /></a></p>
<p style="text-align: left;">At about 11pm on the night before I headed off for the States, Ted the Vet and I sat down to talk <a href="http://pdonelan.github.com/tarpo">Tarpo</a>.</p>
<p>In case you&#8217;re wondering, Tarpo is an open source, cross platform Data Management desktop application for <a href="http://www.amrric.org/">Dog Health programs in rural and remote Indigenous Australian communities</a>, written entirely in Javascript.</p>
<p>The last time I <a href="http://blog.patspam.com/2008/tarpo">blogged about Tarpo</a> was way back in April 2008, and since then I haven&#8217;t really touched the code, but in the meantime Ted and his team of helpers have used it to record several thousand House Visits, Medical and Surgical Cases as part of the Maningrida Dog Health program.</p>
<p>Several other Veterinarians have started expressing interest in using Tarpo for their own Dog Health programs, and needless to say, we&#8217;ve accumulated a long list of bugs and feature requests over the past 18 months. So this afternoon, with a bit of spare time up my sleeve, I decided to get the ball rolling again.</p>
<p>Tarpo now has a proper project page, which you can visit at: <a href="http://pdonelan.github.com/tarpo/">http://pdonelan.github.com/tarpo</a></p>
<p>As you can see from the url, the code now lives on GitHub. Apart from the front page which has the all-important &#8220;Install Tarpo&#8221; button, the most important page on the GitHub project page is the <a href="http://github.com/pdonelan/tarpo/issues">Issue Tracker</a>, which I&#8217;m hoping Ted and other Vets will use to report all Bugs and Feature requests. With a bit of luck, that will also make it easier for other developers to get involved too.</p>
<p>With these things in place, I started attacking the bit rot. Firstly I had to install <a href="http://aptana.com">Aptana</a> and the Adobe Air plugin, which took several hours and reminded me how much I prefer doing development in <a href="http://padre.perlide.org">Padre</a>! On a side note, I spent a few hours trying to think if there was some way I could rewrite the entire app in Perl (I like Javascript in a twisted sort of way, but I&#8217;d rather ditch Adobe Air since it&#8217;s a proprietary framework) &#8211; but in the end I decided to stuck with the existing architecture, at least for now.</p>
<p>I though about doing it as a <a href="http://wxperl.sourceforge.net">wxPerl</a> app (like Padre), but I&#8217;d hate to lose the HTML widget set that <a href="http://extjs.com">ExtJS</a> gives me.. hmm that gets me thinking (help me out if you&#8217;re reading Gábor or any of the other Padre gurus..) does wxPerl have a modern embedded browser that I could use? Maybe webkit-based one..? Then the backend could be rewritten as a standalone <a href="http://plackperl.org/">Plack</a>-powered webapp and I&#8217;d have all of CPAN at my disposal.. hmm maybe that&#8217;s too ambitious, but it does feel like the sort of thing you *should* be able to do with Perl..</p>
<p>I didn&#8217;t have much time left to do any real coding after that, except for updating a few dependencies so that Tarpo at least starts up ok on the latest version of Adobe Air (a small victory). But at least now in a position to start attacking the <a href="http://github.com/pdonelan/tarpo/issues">ticket list</a>, which means that real progress can&#8217;t be too far off..</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/tarpo-now-on-github/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plack roundup at SF.pm</title>
		<link>http://blog.patspam.com/2009/plack-roundup-at-sf-pm</link>
		<comments>http://blog.patspam.com/2009/plack-roundup-at-sf-pm#comments</comments>
		<pubDate>Sun, 29 Nov 2009 18:50:57 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Comp]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1271</guid>
		<description><![CDATA[Miyagawa has posted up a screencast of his recent PSGI/Plack talk at SF.pm. I highly recommend it if you&#8217;re still getting your head round the whole PSGI/Plack thing or you want to watch a nice recap of recent developments.
I got a kick out of seeing Miyagawa pull up my blog post on PlebGUI in response [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bulknews.vox.com/">Miyagawa</a> has <a href="http://bulknews.typepad.com/blog/2009/11/plack-and-psgi-screencast-and-feedbacks.html">posted up a screencast</a> of his recent <a href="http://plackperl.org/">PSGI/Plack</a> talk at <a href="http://sf.pm.org/">SF.pm</a>. I highly recommend it if you&#8217;re still getting your head round the whole PSGI/Plack thing or you want to watch a nice recap of recent developments.</p>
<p>I got a kick out of seeing Miyagawa pull up my <a href="http://blog.patspam.com/2009/plebgui-webgui-meets-plack">blog post on PlebGUI</a> in response to someone&#8217;s question about porting mod_perl applications (e.g. apps that pass around an Apache <strong>$r</strong> object) to Plack. For the sake of the guy who asked the question, the way I did it (at least for the first pass) should be equally viable for other mod_perl applications &#8211; just <a href="http://github.com/pdonelan/webgui/blob/plebgui/lib/WebGUI/Session/Plack.pm">create</a> a fake Apache $r object that delegates everything to <a href="http://github.com/miyagawa/Plack-Request/blob/master/lib/Plack/Request.pm">Plack::Request</a> and <a href="http://github.com/miyagawa/Plack-Request/blob/master/lib/Plack/Response.pm">Plack::Response</a> (your mileage will obviously vary depending on how much of the mod_perl API your app uses).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/plack-roundup-at-sf-pm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ATO + Linux = FAIL</title>
		<link>http://blog.patspam.com/2009/ato-linux-fail</link>
		<comments>http://blog.patspam.com/2009/ato-linux-fail#comments</comments>
		<pubDate>Tue, 24 Nov 2009 20:10:45 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Comp]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/2009/ato-linux-fail</guid>
		<description><![CDATA[I keep a windows VirtualBox image lying around for two purposes

To sync music to my iPhone
To use the Australian Tax Office website

I would dearly love to expunge windows from my life entirely, but so far I haven&#8217;t been able to find suitable workarounds. For the iPhone, the obvious solution is to follow chromatic&#8217;s advice and [...]]]></description>
			<content:encoded><![CDATA[<p>I keep a windows <a href="http://www.virtualbox.org">VirtualBox</a> image lying around for two purposes</p>
<ol>
<li>To sync music to my iPhone</li>
<li>To use the<a href="http://ato.gov.au"> Australian Tax Office website</a></li>
</ol>
<p>I would dearly love to expunge windows from my life entirely, but so far I haven&#8217;t been able to find suitable workarounds. For the iPhone, the obvious solution is to follow <a href="http://www.oreillynet.com/linux/blog/2007/01/what_if_hardware_vendors_are_t.html">chromatic&#8217;s advice</a> and buy hardware that supports linux, such as an Android phone &#8211; and now that <a href="http://gizmodo.com/5395801/android-20-review-almost-human">Android 2 is out</a> that is looking increasingly viable.</p>
<p>The ATO issue is rather more intractable. Any linux user in Australia who run a business and/or submits their own tax return via the ATO website will be painfully aware that the site doesn&#8217;t work on non-proprietary operating systems; specifically, anything other than Windows or Mac. The culprit is the &#8220;<a href="http://csi.business.gov.au">Common use Signing Interface (CSI)</a>&#8221; that the site uses to &#8220;allow businesses to securely transact online with Government agencies using digital certificates&#8221;. CSI is written in Java, which despite being a horribly verbose enterprise-friendly language, is at least supposed to be a horribly verbose <strong>cross-platform</strong> enterprise-friendly language (remember <a href="http://en.wikipedia.org/wiki/Write_once,_run_anywhere">WORA</a>?). But in spite of this, the developers did their bit to <a href="http://infotrope.net/blog/2009/10/31/seriously-australia-seriously/">prove Kirrily Robert right</a> and made the application only work under Windows and Mac.</p>
<p>For fun, I decided to <a href="http://ato.gov.au/feedback/fault.asp?referer=http%3A%2F%2Fato.gov.au%2F">submit</a> this as a bug. Subsequent correspondence with the ATO follows for your enjoyment.</p>
<p>Mike@ATO:</p>
<blockquote><p><em>I spoke to you yesterday in relation to the feedback you gave the ATO in relation to our Business Portal.  As I said on the phone  here is an email with some information I have been able to find.</em></p>
<p><em>I have received some advice from our Portal Support area.  Their response to the issues you raised were:</em></p></blockquote>
<p>ATO Portal Support: (my emphasis)</p>
<blockquote><p><em>Stated here is that the client cannot log into the Business Portal as he is running Ubuntu and Firefox. In this situation Firefox is not the issue as Firefox is supported for the Portal and testing has been completed around this.</em></p>
<p><em>The issue for this client is to do with CSI (the digital certificate software) and Ubuntu. CSI would not be able to be installed on Ubuntu and is not supported for CSI software as per the link below:</em></p>
<p><em><a href="Probably not what you wanted to hear and not sure how much this helps you.  It is unlikely that the ATO would be doing any work to address the compatability issues for Ubuntu due to the costs involved and the anticipated small number of users.  The ATO believes that it is complying with the Australian Government's guidelines and recommendations for government websites.  If you believe that the Business Portal is not supporting Firefox and were able to provide the specific circumstances it would give us an pportunity to do further investigations and address those concerns.  If you have any further issues or comments feel free to contact me.  Because of the time differences (I am in Perth) it might be easier to send me an email.  If you prefer you could dial 13 28 69 and ask for Mike Trinca or extn 85749.">http://www.ato.gov.au/onlineservices/content.asp?doc=/content/36220.htm</a></em></p>
<p><em>If the user was using Firefox on a windows based system this would work correctly.</em></p>
<p><em>The difficulty with Linux based operating systems is that <strong>the percentage of users is quite low for Linux operating systems and also there is a large quantity of Linux distributions (or types) making it very difficult to support.</strong></em></p>
<p><em>Hope this answers the queries set out below, if you need any further information please don’t hesitate to contact me.</em></p></blockquote>
<p>Mike@ATO: (my emphasis)</p>
<blockquote><p><em>Probably not what you wanted to hear and not sure how much this helps you.  <strong>It is unlikely that the ATO would be doing any work to address the compatability issues for Ubuntu due to the costs involved and the anticipated small number of users.</strong> The ATO believes that it is complying with the Australian Government&#8217;s guidelines and recommendations for government websites.</em></p>
<p><em>If you believe that the Business Portal is not supporting Firefox and were able to provide the specific circumstances it would give us an pportunity to do further investigations and address those concerns.  If you have any further issues or comments feel free to contact me.</em></p></blockquote>
<p>Me:</p>
<blockquote><p><em>Thanks Mike, I&#8217;m really impressed with the way you&#8217;ve followed up on this.</em></p>
<p><em>That&#8217;s great news re: Firefox.</em></p>
<p><em>If it&#8217;s not imposing too much, would you be able to ask the Portal Support person what percentage of Portal users are Linux users and what percentage of Portal users have Javascript turned off?</em></p>
<p><em>For example, on an internet-wide level, the latest W3C stats show Linux usage at <a href="http://www.w3schools.com/browsers/browsers_os.asp" target="_blank">4.1%</a> vs <a href="http://www.w3schools.com/browsers/browsers_stats.asp" target="_blank">5%</a> for browsers with Javascript turned off. This is likely to vary wildly on a per-site basis, which is why I&#8217;m interested to find out what the specific <span>ATO</span> Portal numbers are.</em></p>
<p><em>I&#8217;m wondering what percentage is required before the Linux user group becomes worth supporting, and seeing how this compares to the current percentage of disabled web users which the <span>ATO</span> website currently supports via Australian Governement Accessibility standards (e.g. <a href="http://australia.gov.au/about/accessibility" target="_blank">http://australia.gov.au/about/accessibility</a>).</em></p></blockquote>
<p>Mike@ATO: (my emphasis)</p>
<blockquote><p><em>The following information is provided in relation to your latest enquiries.</em></p>
<p><em>In relation to the Business Portal we do not gather specific statistics regarding specific operating system usage or if a user has Java script turned off.  In saying this though I could assume that there would be 0% Portal users utilising a Linux Distro, reasoning behind this response is where by CSI (the software that allows login with a digital certificate) cannot be loaded onto or used on a Linux operating system and is not supported by the ATO.  So basically there wouldn&#8217;t be any users as they wouldn&#8217;t be able to access via Linux.  Regarding the Java script query, this is not something we would be able to answer as we do not gather those statistics.</em></p>
<p><em>The statistics you have quoted are an internet wide statistic as stated and cannot be related to the Portal as in the first response there would not be any users as CSI is not supported for Linux.</em></p>
<p><em>It should be noted that as the stats for usage for Linux is quite low this is not just an issue affecting the Portal and the ATO. <strong>There are a plethora of systems and software that does not support Linux as the user base is just not there to support.</strong> This position also aligns to that of the majority of the software developers producing the accounting and practice management software used by our clients.</em></p>
<p><em>The link you provided to the Australian Government Accessibility Standards goes to a page discussing the commitments by the Australian Government to ensure access to online information for people with disabilities.  There is no corollary between our obligations to support users with disabilities and users of specific operating software.  Government agencies are bound by specific legislation (Disabilities Discrimination Act) on the issue of accessibility of Government services.  This does not apply in the case of operating software choice.</em></p>
<p><em>The final point to note is a Catch 22 situation ie Linux users aren&#8217;t clients because the systems don&#8217;t support them and because they can&#8217;t use our systems they&#8217;ll never make up a large enough percentage of our clients to warrant changing our position.  I think the answer to this is that the Linux users of our website as opposed to our installable applications (e-tax, ECI, CSI, eSAT) should not be overly impacted by compatibility issues.  Statistics collected by the ATO show that only 0.3 percent of visitors to ato.gov.au were identified as Linux users.</em></p>
<p><em>In summary:</em></p>
<p><em>* We do not routinely test our online applications against Linux;<br />
* Consequently, we do not support Linux through our technical support areas;<br />
* Given the very low verifiable client base percentage (&lt;1%) that are Linux users, there are no current plans to change this approach;<br />
* There is no defined threshold % at which this position would change.</em></p>
<p><strong><em>Realistically, in the absence of any substantial research or statistics confirming a much greater Linux client base then we are currently aware of, the position stated in the dot points above is unlikely to change.</em></strong></p>
<p><em>I also appreciate that this situation is less than satisfactory to the Linux clients, however, we are bound under our policies and financial legistlation to ensure that expenditure of public monies promotes the efficient, effective and ethical use of all Commonwealth resources and provides value for money.  Any stance other than that above would not be in keeping with our obligations under the Financial Management and Accountability Act.</em></p>
<p><em>Hope this further information answers your enquiries.</em></p></blockquote>
<p>So there you have it. End of story. No ATO for linux users. Ever.</p>
<p>..</p>
<p>heh yeah right.</p>
<p>Where the Australian Government fails you, the linux community saves you. Someone slap me for wasting 3 weeks on an email exchange instead of just asking google.</p>
<p><a href="http://forums.whirlpool.net.au/forum-replies-archive.cfm/1060117.html">Whirlpool.net.au</a> to the rescue:</p>
<pre class="brush: bash;">

sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-plugin
export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
wget http://pki.ato.gov.au/atocsiInstall/CSIinstall.dmg
sudo mkdir /tmp/csi
sudo mount -t hfs -o loop CSIinstall.dmg /tmp/csi
sudo cp -p /tmp/csi/CsiInstaller.pkg/Contents/Resources/jarFiles/csi.jar $JAVA_HOME/lib/ext
sudo cp -p /tmp/csi/CsiInstaller.pkg/Contents/Resources/jarFiles13/jce1_2_2.jar $JAVA_HOME/lib/security
sudo umount /tmp/csi
sudo rmdir /tmp/csi
java au.gov.bafcsi.clapi.crypto.CsiManager # run CSI certificate manager program
</pre>
<p>You can even drop your .csi directory from your windows home dir into your linux home dir and your existing certificates will be appear without any need to manually export/import them. After completing the above steps, <a href="http://www.mail-archive.com/universe-bugs@lists.ubuntu.com/msg38310.html">completely disable AdBlock</a>, restart Firefox and you can log in to the ATO website!<br />
(tested on Ubuntu 9.10).</p>
<p>Now all I have to do is ditch my iPhone..</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/ato-linux-fail/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PlebGUI: WebGUI Meets Plack</title>
		<link>http://blog.patspam.com/2009/plebgui-webgui-meets-plack</link>
		<comments>http://blog.patspam.com/2009/plebgui-webgui-meets-plack#comments</comments>
		<pubDate>Mon, 12 Oct 2009 13:20:02 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1212</guid>
		<description><![CDATA[WebGUI is an Apache mod_perl application. Not just any mod_perl application; reputedly the most deployed mod_perl application on the planet. You&#8217;d be forgiven for thinking that we love Apache. And we do. Mostly.
But you see mod_perl is an overly zealous lover. Every intimate phase of the Apache request cycle is offered up to your eager [...]]]></description>
			<content:encoded><![CDATA[<p>WebGUI is an Apache mod_perl application. Not just any mod_perl application; <a href="http://www.ohloh.net/p/WebGUI">reputedly</a> the most deployed mod_perl application on the planet. You&#8217;d be forgiven for thinking that we love Apache. And we do. Mostly.</p>
<p>But you see mod_perl is an overly zealous lover. Every intimate phase of the Apache request cycle is offered up to your eager Perl embrace. Sure, you have to learn a few new tricks to get decent performance (such as two-tier mod_proxy/mod_perl) but hey it&#8217;s 2001 and mod_perl is SO much better than CGI. Without hesitation you commit to a life of <strong>PerlResponseHandler</strong>s and <strong>Apache2::Const::OK</strong>s.</p>
<p>Years pass. Life is good.</p>
<p>Your user base had become very adept at deploying Apache. In fact you make life easier for them by <a href="http://sourceforge.net/projects/pbwebgui/files/WebGUI%20Runtime%20Environment/">distributing</a> the complete Perl/Apache/MySQL stack as a simple installer, pre-configured for optimum performance.</p>
<p>Every now and then someone appears on the mailing list asking questions about WebGUI 5, a throw-back to the days when it used to be possible to deploy WebGUI on cheap shared hosting cPanel servers in CGI mode. You want to help, but WebGUI has become so powerful that CGI mode isn&#8217;t feasible anymore. That&#8217;s the price that was paid for evolving into an Enterprise-grade system. Developers <a href="http://www.webgui.org/webgui/campaigns/people/patrick-donelan">lament</a> the fact that small-time users can&#8217;t take advantage of all the awesome things WebGUI can do, not to mention all the word-of-mouth promotion WebGUI is missing out on, but them&#8217;s the brakes. WebGUI continues to grow. &#8220;Carrier-grade&#8221; is the new black. And across town, the non-enterprise crowd is left to content themselves with <a href="http://wordpress.org/">Wordpress</a>, <a href="http://www.joomla.org/">Joomla</a> and <a href="http://drupal.org/">Drupal</a>.</p>
<p>And then a guy called <a href="http://profile.typepad.com/miyagawa">Tatsuhiko Miyagawa</a> comes along.</p>
<p>He says, gee, look at these wonderful server abstractions that Python (<a href="http://www.python.org/dev/peps/pep-0333/">WSGI</a>) and Ruby (<a href="http://rack.rubyforge.org/">Rack</a>) have. The Perl world might have moved on from CGI to things like Catalyst::Engine::* and HTTP::Engine, but there&#8217;s still duplicated effort everywhere. We can do better.</p>
<p>So he sits down and writes <a href="http://github.com/miyagawa/psgi-specs">PSGI</a>, an absurdly simple, manifestly beautiful specification for an interface between Perl web apps and web servers (drawing heavily on WSGI and Rack for inspiration).</p>
<h3>PSGI</h3>
<p>The idea goes like this: Web applications, when all is said and done, are really just on about sending three pieces of information to web browsers: a HTTP status code, a list of HTTP headers, and some content (a file or some text, normally HTML).</p>
<p>This is the specification:</p>
<pre class="brush: perl;">
[                                           # an array ref, containing..
    200,                                    # a HTTP status code
    [ 'Content-Type' =&gt; 'text/html', .. ],  # an array of HTTP headers
    [ '&lt;html&gt;...&lt;/html&gt;' ],                 # the text content (or a $filehandle)
]
</pre>
<p>And that&#8217;s really all there is to it.</p>
<p>Some people write web apps according to the interface. Other people write server backends according to the interface. Web app developers use whatever whiz-bang technology they like, and as long as they return an array that complies with the spec their web app can run on any server. And server backend developers can do lots of clever things to get that information back to web browsers really fast, and have the results of their work benefit all PSGI/Plack consumers. No more duplicated effort. No more server-specific love lock-in.</p>
<p>And folks took notice. Not just any folks either. Really, really smart people like Yuval Kogman, Stevan Little, Shawn Moore, Matt Trout, Jesse Vincent, Chia-liang Kao, Dave Rolsky, Simon Cozens, ..  (They&#8217;re some of the well-known names that jumped out at me from the <a href="http://github.com/miyagawa/psgi-specs/blob/master/PSGI.pod">PSGI.pod</a> spec doc. The others are probably even smarter, stealth hackers. I know, it&#8217;s scary).</p>
<h3>Plack</h3>
<p>Before you could say <a href="http://plackperl.org/">Plack</a> there was a reference implementation, server backend support for <a href="http://search.cpan.org/search?query=CGI&amp;mode=all">CGI</a>, <a href="http://www.fastcgi.com">FastCGI</a>, <a href="http://perl.apache.org/">mod_perl</a> (welcome back!), <a href="http://search.cpan.org/dist/AnyEvent/lib/AnyEvent.pm">AnyEvent</a>, <a href="http://search.cpan.org/dist/Coro/Coro.pm">Coro</a>, <a href="http://www.danga.com/perlbal/">Perlbal</a>, <a href="http://nginx.net/">Nginx</a>, .. framework support for <a href="http://www.catalystframework.org/">Catalyst</a>, <a href="http://cgi-app.org/">CGI-Application</a>, <a href="http://www.masonhq.com/">Mason</a>, <a href="http://search.cpan.org/~awwaiid/Continuity/">Continuity</a>, <a href="http://maypole.perl.org/">Maypole</a>, <a href="http://mojolicious.org/">Mojo</a> .. and a whole suite of Middleware and Utilities.</p>
<p>Meaning that all of a sudden any web app written in one of those frameworks can now be deployed on any of those servers. Or on the pure-perl standalone server that runs from the command line. Or on one of the more experimental/exotic servers I haven&#8217;t listed. If you&#8217;re not excited yet, just wait until <a href="http://code.google.com/appengine/">Google AppEngine</a> appears in that list.</p>
<h3>WebGUI</h3>
<p>But where is WebGUI! The problem is that WebGUI is both a framework and a web app. A really big web app. With a mod_perl addiction. Frameworks are built with multiple servers in mind, so they generally already have an in-built server abstraction layer. Which makes adding PSGI support relatively simple. WebGUI, on the other hand, deliberately eschews an abstraction layer so that it can fully embrace mod_perl and eke out every last ounce of power and performance it can from Apache.</p>
<p>So, faced with extreme framework envy, I did what any reasonable person would do.</p>
<p>I built a PSGI/Plack layer for WebGUI.</p>
<h3>PlebGUI</h3>
<p>I&#8217;ve codenamed the project &#8220;<a href="http://github.com/pdonelan/webgui/tree/plebgui">PlebGUI</a>&#8220;, which I think aptly describes the way it makes it possible for the little people to run WebGUI on low-cost shared hosting.</p>
<p>And it actually works. Take for instance <a href="http://plebgui.patspam.com">plebgui.patspam.com</a>, a demo PlebGUI site site running in FastCGI mode on <a href="http://www.hostmonster.com/">HostMonster</a> (the prototypical low-cost shared webhost).</p>
<h3>app.psgi</h3>
<p>The second wonderously simple idea in the PSGI spec is that a web app is just a plain old perl subroutine. Here&#8217;s one I prepared earlier:</p>
<pre class="brush: perl;">

sub { [ 200, [ 'Content-Type' =&gt; 'text/html' ], [ 'Hello World' ] ] }
</pre>
<p>I know, it&#8217;s almost insulting. I&#8217;m a web developer man! I do sophisticated things! But try putting that single-line sub into a test file called <strong>app.psgi</strong>. And then after you&#8217;ve installed Plack (it&#8217;s not on CPAN yet so you have to install it from miyagawa++&#8217;s <a href="http://github.com/miyagawa/Plack">git repo</a>) try running this:</p>
<pre class="brush: bash;">

$ plackup
Accepting connections at http://0:8080/
</pre>
<p>Go on, visit that url in your web browser. Hello to you too!</p>
<h3>Middleware</h3>
<p>Ok that was a cute trick, let&#8217;s try something more exciting:</p>
<pre class="brush: perl;">

use Plack::Builder;
builder {
    add &quot;Plack::Middleware::Static&quot;, path =&gt; qr/./, root =&gt; '/var/www';
    sub { [ 404, [ &quot;Content-Type&quot; =&gt; &quot;text/plain&quot; ], [ &quot;Not Found&quot; ] ] };
};
</pre>
<p>Congratulations, you just added your first Middleware. Assuming you have some static files located at <em>/var/www</em>, you&#8217;ll get the static files returned to your browser with the correct mimetype (thanks to <em>Plack::Middleware::Static</em>). Middleware just wraps your web app (a plain old Perl sub) with another plain old Perl sub. Middleware can do logging, <a href="http://bulknews.typepad.com/blog/2009/10/develstacktraceashtml.html">pretty</a> HTML stack traces, pre/post processing, or anything else you like. Simple, but immensely powerful.</p>
<h3>Plackup</h3>
<p>Plackup is a simple utility script that launches your web app with a specified server backend. By default it runs the pure-perl standalone development server. It expects your webapp to live in a file, similar to the ones we just created. Want to run your web app on another server backend? Try one of these:</p>
<pre class="brush: bash;">

plackup                                         # dev server with StackTrace and AccessLog enabled
plackup -s CGI                                  # remember how slow web apps used to be?
plackup -s AnyEvent                             # nonblocking
plackup -s Coro --port 9090                     # coroutines
plackup -s Standalone::Prefork --max-workers 20 # blazingly fast preforking ftw!
</pre>
<h3>dev.localhost.localdomain.psgi</h3>
<p>Here&#8217;s what the current per-site .psgi file looks like for PlebGUI:</p>
<pre class="brush: perl;">

use Plack::Builder;
use lib '/data/WebGUI/lib';
use WebGUI;

builder {

 # Populate $env from site.conf
 add 'Plack::Middleware::WebGUI',
   root =&gt; '/data/WebGUI',
   config =&gt; 'dev.localhost.localdomain.conf';

 # Handle /extras via Plack::Middleware::Static
 add 'Plack::Middleware::Static',
   path =&gt; qr{^/extras/},
   root =&gt; '/data/WebGUI/www';

 # Handle /uploads via Plack::Middleware::WGAccess (including .wgaccess)
 add 'Plack::Middleware::WGAccess',
   path     =&gt; qr{^/uploads/},
   root =&gt; '/data/domains/dev.localhost.localdomain/public';

 sub { WebGUI::handle_psgi(shift) };
}
</pre>
<p>What you can see there are 3 Middleware layers <strong>add</strong>ed in, one to set up the WebGUI site-specific environment, one to handle <em>/extras</em> static content, and one to handle <em>/uploads </em>static content (taking into account <em>.wgaccess</em> file permissions).</p>
<p>All of those <strong>plackup</strong> command variations above can be used to launch WebGUI outside of mod_perl. Prefer running inside of Apache? How about one of these:</p>
<pre class="brush: xml;">

&lt;VirtualHost *:80&gt;
 PerlOptions +Parent
 PerlSwitches -I/data/WebGUI/lib

 # CGI
 #AddHandler cgi-script cgi
 #ScriptAlias / /data/WebGUI/etc/dev.localhost.localdomain.cgi/
 #&lt;Directory /data/WebGUI/etc&gt;
 #   Options +ExecCGI
 #&lt;/Directory&gt;

 # mod_perl
 #SetHandler perl-script
 #PerlHandler Plack::Server::Apache2
 #PerlSetVar psgi_app /data/WebGUI/etc/dev.localhost.localdomain.psgi

 # FastCGI
 FastCgiServer /data/WebGUI/etc/dev.localhost.localdomain.fcgi
 ScriptAlias / /data/WebGUI/etc/dev.localhost.localdomain.fcgi/

 # mod_psgi
 #&lt;Location /&gt;
 #    SetHandler psgi
 #    PSGIApp /data/WebGUI/etc/dev.localhost.localdomain.psgi
 #&lt;/Location&gt;

&lt;/VirtualHost&gt;
</pre>
<p>Using those directives you can run WebGUI in CGI, mod_perl, FastCGI mode, or even the in-development <a href="http://github.com/spiritloose/mod_psgi/">mod_psgi Apache module</a>.</p>
<h3>Benchmarks</h3>
<p>Ok so how fast are these different backends? Let&#8217;s use ApacheBench to do some simple, unscientific tests of how many requests per second we can squeeze out of WebGUI.</p>
<p>First we&#8217;ll start with WebGUI in its original, un-plebified form, running on the WRE (more is better):</p>
<p>$ ab -n 1000 -c 10 -k http://dev.localhost.localdomain:8081/ | grep &#8216;Requests per&#8217;<br />
Requests per second:    <strong>122.77</strong> [#/sec] (mean)</p>
<p>The result is of course completely dependent on your Apache configuration &#8211; in this case I have (StartServers, MinSpareServers, MaxSpareServers, MaxClients) = (5,5,10,20).</p>
<p>Ok, now have a look at these numbers:</p>
<p>$ ./ab.pl &#8211;app /data/WebGUI/etc/dev.localhost.localdomain.psgi<br />
<em>Testing implementations: AnyEvent, Standalone, Standalone::Prefork, ServerSimple, Coro<br />
app: /data/WebGUI/etc/dev.localhost.localdomain.psgi<br />
ab:  ab -n 1000 -c 10 -k<br />
URL: http://127.0.0.1/<br />
</em><br />
<strong>&#8211; server: AnyEvent</strong><br />
Accepting requests at http://0.0.0.0:10001/<br />
Requests per second:    <strong>68.06</strong> [#/sec] (mean)</p>
<p><strong>&#8211; server: Standalone</strong><br />
Accepting connections at http://0:10001/<br />
Requests per second:    <strong>64.92</strong> [#/sec] (mean)</p>
<p><strong>&#8211; server: Standalone::Prefork</strong><br />
Accepting connections at http://0:10001/<br />
Requests per second:    <strong>214.54</strong> [#/sec] (mean)</p>
<p><strong>&#8211; server: ServerSimple</strong><br />
Plack::Server::ServerSimple: You can connect to your server at http://localhost:10001/<br />
Requests per second:    <strong>66.43</strong> [#/sec] (mean)</p>
<p><strong>&#8211; server: Coro</strong><br />
2009/10/11-23:17:32 Plack::Server::Coro::Server (type Net::Server::Coro) starting! pid(1581)<br />
Requests per second:    <strong>67.55</strong> [#/sec] (mean)</p>
<p>Did you see that? Standalone::Prefork is almost twice as fast as WebGUI in the WRE! The pre-forking server&#8217;s <em>max-workers</em> setting defaults to 10, so the comparison might actually be fair too.</p>
<h3>Holy Shit</h3>
<p>I think that&#8217;s worth repeating. PlebGUI, which is currently less than one week old and running on a compatibility layer optimised for &#8220;let&#8217;s just get this thing working and worry about performance later&#8221; is already capable of out-performing the WRE in terms of raw speed by 200%. (If you believe the benchmarks).</p>
<p>But Plack/PSGI is not just about speed. It&#8217;s about <strong>flexibility</strong>. Think Koen de Jonge, WebGUI hosting extraordinaire at Procolix, deploying a high availability &#8220;follow the sun&#8221; WebGUI cluster on Nginx servers. Think Colin Kuskie, WebGUI test suite overlord, probing the dark corners of the WebGUI API using standard HTTP::Request and HTTP::Response pairs through mocked HTTP and live HTTP servers. Think web developers working on WebGUI client code, with a web server fully integrated into Padre. Think WebGUI entirely deployable from the CPAN.</p>
<p>Think of every new project added to the PSGI/Plack ecosystem as a potential new PlebGUI feature.</p>
<h3>Where to Now</h3>
<p>The approach I took in turning WebGUI into PlebGUI was to create a fake Apache2::Request object, since that&#8217;s the closest thing WebGUI has to a server abstraction layer. Plack contains two helper classes <em>Plack::Request</em> and <em>Plack::Response</em> that make this really easy. Currently though, that leaves us in the curious situation where WebGUI does all of its work thinking it&#8217;s talking to mod_perl, only to have its real output re-routed through the PSGI-compatibility layer, to be subsequently processed by a specific server backend. If you don&#8217;t get the joke yet, just think about what happens when the PSGI server backend happens to be mod_perl.</p>
<p>The benchmarks would clearly improve if we ripped out mod_perl altogether. Lots of code would simplify too. Certain parts of WebGUI could disappear altogether, such as URL Handlers which could be entirely replaced with Middleware.</p>
<p>The only feature that PlebGUI currently lacks is content streaming. I deliberately left that out since it will be a lot easier to achieve once mod_perl disappears. In Plack land the way to drip-feed browsers with &#8220;chunked&#8221; content is to return an <a href="http://search.cpan.org/~gbarr/IO-1.25/lib/IO/Handle.pm">IO::Handle</a>-like object that responds to getline() and close(). The Plack folks are planning a fancy new module called IO::Writer that will Do The Right Thing under both blocking and non-blocking servers. Expect awesome things.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/plebgui-webgui-meets-plack/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Padre::Plugin::WebGUI Tab Icons</title>
		<link>http://blog.patspam.com/2009/padrepluginwebgui-tab-icons</link>
		<comments>http://blog.patspam.com/2009/padrepluginwebgui-tab-icons#comments</comments>
		<pubDate>Thu, 01 Oct 2009 09:49:25 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1208</guid>
		<description><![CDATA[Version 0.03 of Padre::Plugin::WebGUI (my WebGUI plugin for the Padre Perl IDE) is on its way to the CPAN, with one small but rather nice feature: tab icons. Just as the plugin uses WebGUI&#8217;s native icons to display the Asset Tree for your site, you now get the same attractive icon in the tab that [...]]]></description>
			<content:encoded><![CDATA[<p>Version 0.03 of <a href="http://search.cpan.org/dist/Padre-Plugin-WebGUI/">Padre::Plugin::WebGUI</a> (my WebGUI plugin for the Padre Perl IDE) is on its way to the CPAN, with one small but rather nice feature: tab icons. Just as the plugin uses WebGUI&#8217;s native icons to display the Asset Tree for your site, you now get the same attractive icon in the tab that opens up when you double-click to edit something. Apart from the aesthetics, it&#8217;s handy to know at a glance what sort of asset you&#8217;re editing (WebGUI uses the same trick for the edit icons on your site when you turn admin mode on). I was hoping to be able to add hover-text too (in case you don&#8217;t recognise the Asset type from its icon) but thus far I haven&#8217;t figured out if wxPerl and/or Padre supports it.</p>
<p>The following screenshot shows a nice example of several tabs open at once with different WebGUI Asset types displaying their own icons.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/10/Tab_Icons.png"><img class="alignnone size-medium wp-image-1209" title="Tab_Icons" src="http://blog.patspam.com/wp-content/uploads/2009/10/Tab_Icons-300x121.png" alt="Tab_Icons" width="300" height="121" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/padrepluginwebgui-tab-icons/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Padre::Plugin::WebGUI now with remote editing</title>
		<link>http://blog.patspam.com/2009/padrepluginwebgui-now-with-remote-editing</link>
		<comments>http://blog.patspam.com/2009/padrepluginwebgui-now-with-remote-editing#comments</comments>
		<pubDate>Sat, 26 Sep 2009 14:26:20 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1191</guid>
		<description><![CDATA[Up until now the WebGUI Padre plugin I&#8217;ve been working on has been more or less a proof-of-concept / toy / test-bed for experimental ideas. Whilst that has been fun (and made for good conference slides), the reality is that I haven&#8217;t actually been using the plugin for my daily WebGUI development, so how could [...]]]></description>
			<content:encoded><![CDATA[<p>Up until now the <a href="http://webgui.org">WebGUI</a> <a href="http://padre.perlide.org">Padre</a> plugin I&#8217;ve been <a href="../2009/padrepluginwebgui">working on</a> has been more or less a proof-of-concept / toy / test-bed for experimental ideas. Whilst that has been fun (and made for good conference slides), the reality is that I haven&#8217;t actually been using the plugin for my daily WebGUI development, so how could I expect other WebGUI developers to do so?</p>
<p>I&#8217;m hoping to change that. As of today I&#8217;ve stripped out all the experimental features and concentrated on the single feature that seems to have the widest possible appeal, namely, <strong>remote editing</strong>.</p>
<p>Version 0.02 of <a href="http://search.cpan.org/search?query=Padre%3A%3APlugin%3A%3AWebGUI&amp;mode=all">Padre::Plugin::WebGUI</a>, which is on its way to the CPAN, allows you to connect over HTTP to your webgui site, view you asset tree and edit your assets from inside the Padre text editor. That hopefully makes it as useful for designers and content managers as it is for developers.</p>
<p>Previously the plugin got most of its power from the WGDev library. However this meant that you had to install WebGUI and WGDev as a prerequisite. Given that the WRE ships with non-threaded perl, this meant either installing these prereqs into your system perl or building another perl specifically to run them.  Not an overly arduous task, but enough of a hurdle to dissuade most WebGUI developers from playing with the plugin. That obstacle has now been removed. You do not need to have WebGUI or WGDev installed to run the plugin.</p>
<p>Using WGDev also meant that you could only connect locally to your site. That restriction is now gone.</p>
<p><strong>Installation</strong></p>
<p>Firstly, <a href="http://padre.perlide.org/download.html">install Padre</a>.<strong><br />
</strong></p>
<p>To allow your WebGUI site to talk to the plugin, add <a href="http://github.com/pdonelan/webgui/blob/padre/lib/WebGUI/Content/Padre.pm">this content handler</a> (WebGUI::Content::Padre) to your site and restart modperl  (the easiest way to do this is to drop the module into your <em>/data/WebGUI/lib/WebGUI/Content</em> dir and add the new content handler to your site config file. There is also an <a href="http://github.com/pdonelan/webgui/blob/padre/sbin/installPadre.pl">install script</a> that will do the site config editing for you).</p>
<p>Next install the plugin from the CPAN</p>
<pre class="brush: bash;">

cpan Padre::Plugin::WebGUI
</pre>
<p><strong>Usage</strong></p>
<p>Inside Padre, go to the Plugin Manager and enable the WebGUI plugin. You should then see a WebGUI item appear in your Plugins menu.</p>
<p>From the WebGUI menu, tick &#8220;Show Asset Tree&#8221; and double-click on &#8220;Connect&#8221; in the new panel that appears.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/connect.png"><img class="alignnone size-medium wp-image-1193" title="connect" src="http://blog.patspam.com/wp-content/uploads/2009/09/connect-300x186.png" alt="connect" width="300" height="186" /></a></p>
<p>You will be prompted for the URL of the site you want to connect to. Currently you need to enter you the site in the form: <em>http://username:password@site.com</em> (later we will add a site manager to make this nicer). Remember that this can be any webgui site that you have access to, not just a local site.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/connect2.png"><img class="alignnone size-medium wp-image-1194" title="connect2" src="http://blog.patspam.com/wp-content/uploads/2009/09/connect2-300x67.png" alt="connect2" width="300" height="67" /></a></p>
<p>You will then see the Asset Tree dynamically populated with information from your site.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/asset_tree.png"><img class="alignnone size-medium wp-image-1192" title="asset_tree" src="http://blog.patspam.com/wp-content/uploads/2009/09/asset_tree-300x186.png" alt="asset_tree" width="300" height="186" /></a></p>
<p>Try double-clicking on an article.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/getting_started.png"><img class="alignnone size-medium wp-image-1196" title="getting_started" src="http://blog.patspam.com/wp-content/uploads/2009/09/getting_started-300x186.png" alt="getting_started" width="300" height="186" /></a></p>
<p>A new file tab should open with the name set to the name of your article (with [wg] prepended). The article content will be loaded into to tab, with Padre&#8217;s HTML syntax highlighting in effect. If you have Padre::Plugin::HTML installed, you can use the Tidy/Lint/Validate the HTML to your heart&#8217;s content. And every time you hit Save, your changes will be pushed up to the site as a new Version Tag.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/look_ma.png"><img class="alignnone size-medium wp-image-1198" title="look_ma" src="http://blog.patspam.com/wp-content/uploads/2009/09/look_ma-300x191.png" alt="look_ma" width="300" height="191" /></a></p>
<p>Try double-clicking on another sort of asset, for instance a Template. Once again, the template html will be loaded into a new tab with nice syntax highlighting.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/template.png"><img class="alignnone size-medium wp-image-1199" title="template" src="http://blog.patspam.com/wp-content/uploads/2009/09/template-300x186.png" alt="template" width="300" height="186" /></a></p>
<p>And for fun, try opening up a CSS Snippet. The plugin will detect that your snippet is set to the &#8216;text/css&#8217; mime type and use CSS code highlighting instead of HTML.</p>
<p><a href="http://blog.patspam.com/wp-content/uploads/2009/09/css.png"><img class="alignnone size-medium wp-image-1195" title="css" src="http://blog.patspam.com/wp-content/uploads/2009/09/css-300x186.png" alt="css" width="300" height="186" /></a></p>
<p>And similarly for JavaScript Snippets.</p>
<p><a href="../wp-content/uploads/2009/09/javascript.png"><img title="javascript" src="../wp-content/uploads/2009/09/javascript-300x164.png" alt="javascript" width="300" height="164" /></a></p>
<p><strong>Design and Extensions</strong></p>
<p>As far as Padre is concerned the file you are editing is just a regular file on your file system. For example when you edit the text, an asterisk (*) appears next to the name of the file indicating that you haven&#8217;t save it yet.  The integration between the webgui content handler and the plugin is minimal, meaning that you could conceivably use this plugin to do remote editing on non-webgui sites too.</p>
<p>Padre has a nice architectural design, which makes it really easy for us to associate different WebGUI::Asset types with Padre::Document types. Currently most assets delegate to the default <em>Padre::Document::WebGUI::Asset</em> module which does HTML syntax highlighting and expects only generic content from the content handler running on your site. <em>Padre::Document::WebGUI::Snippet</em> has a slightly higher IQ level in that it asks the server to tell it what mimetype the asset is set to, so that it can use the appropriate syntax highlighter.</p>
<p>We could do some really interesting things by building asset-specific Padre::Document modules. For instance you could build a document type that uses fancy wxWidgets controls to do things that aren&#8217;t possible on the web (desktop integration etc..) And it&#8217;s just as easy to build these for your own custom asset types as it is for core ones. Given that Padre is cross-platform, you&#8217;re basically looking at a way of extending WebGUI interactions out into desktop-land.</p>
<p>If you&#8217;re a WebGUI designer/developer/content manager and you want to start playing with Padre::Plugin::WebGUI as a novel way of editing content, come find me on #webgui or #padre.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/padrepluginwebgui-now-with-remote-editing/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Finding missing WebGUI Templates</title>
		<link>http://blog.patspam.com/2009/finding-missing-webgui-templates</link>
		<comments>http://blog.patspam.com/2009/finding-missing-webgui-templates#comments</comments>
		<pubDate>Thu, 30 Jul 2009 09:06:59 +0000</pubDate>
		<dc:creator>Patrick</dc:creator>
				<category><![CDATA[Comp]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[WebGUI]]></category>

		<guid isPermaLink="false">http://blog.patspam.com/?p=1181</guid>
		<description><![CDATA[Following on from my previous WGDev post, here&#8217;s another example of wgd ls that lets you find missing Templates on a WebGUI site.
One problem that content managers run into is that after deleting a template in WebGUI, any assets that still refer to the template will die a horrible death when users try to view [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from my <a href="http://blog.patspam.com/2009/ode-to-wgd-and-the-command-line">previous WGDev post</a>, here&#8217;s another example of <strong>wgd ls</strong> that lets you find missing Templates on a WebGUI site.</p>
<p>One problem that content managers run into is that after deleting a template in WebGUI, any assets that still refer to the template will die a horrible death when users try to view them. What would be nice is an automated way of finding all such assets that refer to missing template, so that you can update them to refer to a different template.</p>
<p>For starters, WGDev can give you a list of all available templates on your site via:</p>
<pre class="brush: bash;">

wgd ls root -r --format %assetId% --includeOnlyClass WebGUI::Asset::Template | sort | uniq &gt; available
</pre>
<p>You can also ask for a list of all in-use templateIds, via:</p>
<pre class="brush: bash;">

wgd ls root -r --format %templateId% --filter '%templateId% ~~ /.+/' | sort | uniq &gt; in_use
</pre>
<p>All you need to do then is ask the <a href="http://www.gnu.org/software/coreutils/manual/html_node/comm-invocation.html">comm</a> command to tell you which templateIds are <em>in_use</em> but not <em>available</em>:</p>
<pre class="brush: bash;">

comm -23 in_use available
</pre>
<p>Putting it all together on one line (without the temporary files), that becomes:</p>
<pre class="brush: bash;">

comm -23 &lt;(wgd ls root -rf %templateId% --filter '%templateId% ~~ /.+/' | sort | uniq) &lt;(wgd ls root -rf %assetId% --includeOnlyClass WebGUI::Asset::Template | sort | uniq)
</pre>
<p>The output of this command is a nice list of missing templateIds.</p>
<p>Of course, what you probably then want to do is ask WGDev to give you a list of asset urls that are trying to use these missing Templates, for example, if one item in your list is <em>eHMsLCMqoXYpYrsZ7CWUtg</em>, you would do:</p>
<pre class="brush: bash;">

wgd ls root -rf %url% --filter '%templateId% ~~ eHMsLCMqoXYpYrsZ7CWUtg'
</pre>
<p>Which would print something like</p>
<pre class="brush: bash;">

/my/broken/asset/url
</pre>
<p>Combining this with the previous command to do it all on one line is left as an exercise for the reader <img src='http://blog.patspam.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Now, <strong>templateId</strong> isn&#8217;t the only Asset field that templates can be referenced under, for example, if you want to also find missing Style and Printable Style templates, you&#8217;d want to do something like:</p>
<pre class="brush: bash;">

for tmpl in templateId styleTemplateId printableStyleTemplateId
do
comm -23 &lt;(wgd ls root -rf %${tmpl}% --filter &quot;%${tmpl}% ~~ /.+/&quot; | sort | uniq) &lt;(wgd ls root -rf %assetId% --includeOnlyClass WebGUI::Asset::Template | sort | uniq)
done
</pre>
<p>It&#8217;s not optimised for speed, but it sure is handy. And you could apply the same approach to search for invalid group permissions, etc.. Of course if you found yourself doing this often you&#8217;re probably better off writing a dedicated WGDev plugin to wrap up the functionality.</p>
<p>There&#8217;s a <a href="http://github.com/pdonelan/webgui/tree/template_usage">WebGUI branch on GitHub</a> containing some extra <a href="http://www.webgui.org/rfe/request-for-enhancement/10659">Template Usage-related functions</a> &#8211; the plan is to add the ability to find all the different ways that templates are referenced (in Asset definitions, Account module definitions, &#8230;) so perhaps we will end up adding a &#8220;find missing Templates&#8221; button to the Edit Template page.</p>
<p>[ perl ironman ]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.patspam.com/2009/finding-missing-webgui-templates/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
