It’s official: WebGUI 8 will be Plack-powered

June 19th, 2010 by Patrick No comments »

Back in December 2009 I wrote about PlebGUI, an experimental branch of WebGUI with mod_perl replaced with Plack/PSGI. As a result, I was able to demonstrate WebGUI running on shared hosting via Plack + FastCGI.

For the next few months I worked through the process of turning the proof of concept into something core-worthy. Primarily that meant removing PlebGUI’s faked Apache2::Request object, completely eliminating any mod_perl dependencies from the WebGUI core and instead baking in WebGUI::Request and WebGUI::Response which are thin layers over Plack::Request and Plack::Response.

By about April most of the basic pieces were in place, performance was looking good, and I’d started the fun task of refactoring WebGUI to take advantage of the value-add features that Plack brings such as Middleware and stealing liberally from other Plack projects such as Tatsumaki‘s streaming API. But there was still lots of work to be done getting the test suite passing again and smoothing off the rough edges. Progress was slow due to my work commitments and frequent travel.

Then three of the main WebGUI committers got involved, first haarg++, then perlDreamer++ and preaction++. The pace accelerated dramatically. This week we officially merged the PSGI branch into the main development branch, meaning that the next major release of WebGUI will officially be a PSGI app!

Huge credit and thanks to haarg, perlDreamer and preaction (and anyone else who contributed too) for getting us over the hump. These guys are also the main driving force behind the other awesome features that are being baked into WebGUI 8, so if you like anything you see in the next version, make sure you buy them a beer or two.

Here are some screenshots of WebGUI with the Plack::Middleware::Debug bar turned on.

Previously, in debug mode WebGUI would append all debug output to the bottom of the page. Now, thanks to haarg’s custom Plack::Middleware::Debug panels, debug messages are contained within the “Logger” panel. Notice also the “Asset Performance” panel, which displays WebGUI::Asset performance metrics. This is only the beginning.

It’s such a buzz to have the PSGI branch merged in; now the real fun starts! I’ll be speaking about the WebGUI PSGI branch at the WebGUI User Conference in Madison in September, and at the rate things are going, who knows how much fun stuff we’ll be able to show off..

I’m also really looking forward to attending YAPC::NA next week (my first YAPC on American soil) and meeting/hanging out with lots other people who have been doing awesome things in the Perl web app space (and beyond). Vive la renaissance Perl!

Plack Apps in Javascript

June 18th, 2010 by Patrick 3 comments »

Love Plack web apps but feel like writing some Javascript today instead of Perl?

# app.psgi
use Plack::App::JSP;
Plack::App::JSP->new( js => q{
[ 200, [ 'Content-type', 'text/html' ], [ 'Hello, World!' ] ]
});

# displays: Hello, World!

Given the similarities between Perl and JSON you can’t actually tell if I’m cheating or not from the above snippet.

Let’s try something more convincing:

Plack::App::JSP->new( js => q{
function respond(body) {
    return [ 200, [ 'Content-type', 'text/html' ], [ body ] ]
}

respond("Five factorial is " +
    (function(x) {
      if ( x<2 ) return 1;
      return x * arguments.callee(x - 1);
    })(5)
);
});

# displays: Five factorial is 120

I just pushed Plack::App::JSP to the CPAN.
Thanks to Salvador Ortiz and Miguel Ibarra whose recently released JSP module makes this possible.

Giving Ubuntu the middle finger salute

June 8th, 2010 by Patrick No comments »

I couldn’t find any good search engine hits for this, so I’m posting up the details to help others find it.

Supposedly most Lenovo laptops contain a fingerprint reader that works nicely in Ubuntu via ThinkFinger. However my Lenovo T400s uses different hardware (Upek) that isn’t supported by ThinkFinger.

You can find out what hardware your fingerprint reading is by running:

$ lsusb | grep -i finger
Bus 004 Device 002: ID 147e:2016 Upek Biometric Touchchip/Touchstrip Fingerprint Sensor

If yours says Upek line mine does, you can get it running under Ubuntu (and Fedora etc..) by installing fingerprint-gui. The installation process is a little tedius, but it’s worth it to be able to login/sudo/etc.. with a swipe of your finger.

Probably worth getting a few friends to test how susceptible the reader is to false positives though.

Serve up Dancer webapps for six bucks

June 2nd, 2010 by Patrick 7 comments »

After a few weeks of mulling over the Perl Shared Hosting idea, a few enthusiastic messages from people and getting inspired by chromatic musing about a similar idea for a Perl Cookbook, I decided to JFDI.

So, perlsharedhosting.com is now officially up and running.

Rather than wasting my time building a web app for the site before the idea has been proven, I decided to use a simple CMS and focus my energies on the content instead (there’s a wonderful irony in using a PHP CMS to deliver content about Perl shared hosting..).

I’ve added quick-start guides on how to install the following core technologies on your shared hosting account:

These pages are not in any way supposed to replace the official documentation sources. Ideally, they just tell you what the tool/lib  is, why you need it, and how to install it with minimum fuss. In reality, we also need to list any issues you may run into when using them in a shared hosting environment, but the idea is that we feed this information back to the upstream projects so that workarounds become unnecessary.

I’ve tested two different hosting providers, neither of which I’m going to mention by name here because I’m not trying to actually promote their brand.

  • The first one had a major limitation – no access to cc and hence the inability to compile XS modules (their tech support has offered to install CPAN modules on request, but it’s less than ideal).
  • The second one has so far passed all tests with flying colours – “cpanm Task::Kensho” works flawlessly, including all the XS modules. This is perhaps not all that surprising given that this is the same hosting provider that I used last year to get WebGUI running under PSGI on a shared account.

I started playing with Dancer for the first time, and soon had live demos of Dancer running in both CGI and FastCGI modes. Those URLs will change in the future but the idea is that we set up live versions of each web framework running on each hosting provider. Maybe in the future we could use a monitoring service to track the reliability and response time of each combination.

So already, the Perl Shared Hosting site has step-by-step instructions for how to run Dancer web apps on a shared hosting account for less than six bucks per month. That’s not half bad.

If you have a shared hosting account on a provider that isn’t listed (or you work for a shared hosting company and want to get yourself listed) then please contact me to get involved.

Next up, we need to add more information about resource limits. I also plan on adding more web frameworks such as Web::SimpleMojoMojoCatalystTatsumaki, ..

Once we have an idea about what features are most important, I’d like to then turn it around and start contacting the providers to ask them if they will add support for certain features to match (or beat) their competitors. I think there’s real potential for communicating back to the shared hosting providers that there’s a large market for modern Perl hosting, and ideally, what features we need/want. The site may also be useful for feeding back to the Perl toolchain/framework people what rough edges people are running into in shared environments.