Plack Apps in Javascript

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);

# 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

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

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, 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.