September 2010 Archives


I've mentioned this elsewhere, but I thought it was worth mentioning here: my wife and I are moving to Amsterdam next month. After three lovely years with the BBC, I'm giving in to the temptations of Amsterdam and Here comes a new adventure!

Writing Plack Debugging Middleware for Catalyst

I now have our work project running (sort of) on Catalyst 5.80007. This is because it's the oldest version of Catalyst I can use with Plack. I wanted that just because the debugging middleware for Plack is just so friggin' awesome and I wanted to write my own. Now I have and here's how easy it is (with screenshots).

Installing Catalyst by Hand

I'm investigating a particular issue at work and I thought "Plack debugging middleware is exactly what I want right now". Specifically, I want this:

#!/usr/bin/env perl

use strict;
use warnings;
use Dynamite;
use Plack::Builder;

my $app = sub { Dynamite->run(@_) };

builder {
    enable 'Debug', panels => [qw(DBITrace Memory Timer Environment)];

And then I can just do this:

plackup -r -s Starman script/dynamite.psgi

And have beautiful debugging panels appear in my browser, giving me all sorts of useful information.

Or it would be if we weren't running a three frickin' year old version of Catalyst.

Method modifiers, roles, and state

Note this bug report for Mouse. Because of formatting issues with code, I'll repost the code here.

An Unexpected Test Result

I spent several hours debugging a catastrophic test suite failure today. As our test classes take over an hour to run and the failure takes place near the end of the test run, it was a very annoying issue to debug. Unfortunately, the test class in question passed when run by itself, but not when run in the entire suite. That usually means the global state had been altered in an unexpected way, and boy had it! Seems the test was failing because it was trying to run a method that a completely separate test class had -- and those classes weren't related by inheritance. It was very confusing until I finally realized that someone had mistyped a package name at the top of the test class. A few minutes later I had a new test which verified the package name ... and found ten other misspelled package names (out of 325 packages).

Research paper paywalls are awful

This Lambda-the-Ultimate entry is about a study on the efficacy of Transactional Memory (TM). Apparently, TM proponents often claim that it makes concurrent programming easier (I've seen those claims), but that claim is often not backed up by citations. So they refer to this TM study (pdf) designed to test this assertion. The results:

On average, subjective evaluation showed that students found transactions harder to use than coarse-grain locks, but slightly easier to use than fine-grained locks. Detailed examination of synchronization errors in the students' code tells a rather different story. Overwhelmingly, the number and types of programming errors the students made was much lower for transactions than for locks. On a similar programming problem, over 70% of students made errors with fine-grained locking, while less than 10% made errors with transactions.

I know some people deny the utility of software studies, but I don't. I'm rather keen on getting some empirical evidence rather than being the proud captain of the USS Make Stuff Up and that's what many (most?) software debates seem to be when you get into the land of theory. However, what frustrates me even more than that is how difficult it can be to cite anything. Constantly when I'm trying to find a paper, I hit the damned ACM Portal. I wanted to read Language design to enhance programming reliability, but of course I couldn't. You have to pay for it. And what happens when I click their "Purchase a copy" link?

Sorry, No match found for the requested dissertation.
Actual server error: No match found for the requested dissertation. [23123]

It's awful that we have so much scholarship locked away. Karen Pauley (a.k.a., the President of TPF) pays for access, but she comments that when she writes about something she's seen, she can't even link to the source¹ How can I possibly convince you that something is interesting and worthwhile if I can't show it to you? I guarantee that we wouldn't be using roles so heavily today if the original traits research had been locked behind a paywall. How much great work are we missing out on because you have to pay for research papers? Many of those papers are paid for with tax dollars, but you still can't have them.

I might add that many times I can find the paper online by doing a Google search of the paper title in quotes with filetype:pdf added to the end of the query (didn't work for this paper). This isn't kosher, and it makes it hard for me to cite the work, but at least I can use it for personal knowledge. Damn.

1. And she might not even be able to link to that. For the ACM paper I wanted, Karen was able to get to the above article, but it turned out to be a paper written about that time and not the actual thesis. They entice me to buy a paper I want to read but it turns out they don't even have it?

The ORM extension we need

Update: when I wrote on Twitter "Dear lazyweb: please write this code and drop me an email when you're done.", I was kidding. I'm not so silly as to think this is a trivial task (though I'd be delighted to be proven wrong).

I keep thinking about taking a stab at this, but I never quite seem to have the tuits. Essentially, I want a "reporting ORM", but then it wouldn't be an ORM, but it could leverage the metadata of a good ORM to pull off creation of an awesome reporting system.

So imagine your boss comes in an says "I want a report of total sales per salesperson in London". How would you write that? Think about an ORM solution versus SQL.

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See for our services. If you have a problem with Perl, we will solve it for you.