All posts by Huw Lynes

A Day With Catalyst

You may remember that after the Web Frameworks Evening I rashly proposed that I would develop a simple application with each of the frameworks mentioned. Earlier in the week, as good as my word, I took Catalyst out for a spin.

Out of the three frameworks Catalyst was the one I was most intrigued by. I’ve heard too many people in orange sunglasses rave about Rails for me to get really excited about it. Django is written in my favourite language so it’s going to have to be especially horrid for me not to like it. The idea of a web framework that pulls in all the best tools of the Perl universe peaked my interest sufficiently that Catalyst was the first framework I decided to try.

Now full diclosure time. I’m a bit of a Python bigot, but I thought, how many people learn ruby until they get wowed by Rails? If Catalyst is really good it could bring lots of new people into the Perl community. As a relative Perl newbie I make a good test of that idea. Would I find Catalyst sufficiently awesome that I would consider doing web development in something other than my native language?

perl -MCPAN -e 'install Bundle::Catalyst'

Three hours later after a series of cpan force installs I finally had Catalyst installed and not throwing empty Base Class errors. I know my way around CPAN I suspect the vast majority of people new to Perl don’t. You’ve just lost them.

OK onto the tutorial. It’s pretty good. Writing views is really nice. Dispatching URLs to different functions is dead easy. The debugging output of the test server is massively helpful. Right, onto templates. Hmmm…. OK you can call them explicitly by stashing the template name or it does a clever lookup on the name of the view or the function. Nice. I can see how you don’t need a lot of code to get real functionality out of this. It looks like a simple matter to knock up a function that passes an ID through and uses it for a database lookup. So I really need to move on in the tutorial and work out how to connect to my WordPress db and start grabbing some articles.

Well the tutorial only mentions SQLite while I, and probably 99.9% of the world, am runnnig MySQL. Bit of googling should sort it. OK, no your Base Class is empty? Oh. More google. Aha I can connect now. The test server shows me a class has been created on the fly for each of my tables. The table names match what is in the database so I’m confident it’s actually talking to the DB. Right one line of code is all it should take to get data out. I can pass in a valid ID on the URL and use that to grab a record just like they show in the tutorial. But all I get back out is the ID. More google.

Turns out you don’t get magic relationship mapping out of the box with MySQL and Catalyst::Model::CDBI. There probably is a way to do it but I can’t find any documentation on giving it a relationship map by hand. I’ve now spent nine hours trying to coax this whole thing into life so It’s time to cut my losses and move on.

In short if you are not already a Perl hacker who knows his way aroung Class::DBI or Class::DBIx you may not find Catalyst to your taste. Which is a shame because it has moments of greatnes.

Next time: Django

Web Frameworks Evening

Hearing about different web-frameworks turned out to be suprisingly fun. Even if there wasn’t enough room in the pub. It’s probably better for my Liver if I don’t drink.

Most examples you see of how to use Your Favourite Framework involve building some sort of applications from scratch. But it seems to me that it’s much more likely that you would inherit some pre-existing data source and have to build an app against it. So for the purposes of research I’m going to write a simple application in each of the frameworks discussed against a database that already exists; namely this here wordpress blog.

It’ll give me something to do at the weekend anyway.

It’s possible I’m loseing my sanity.

Dim Sum and Jasmine Tea

It being the friday of a particularly hectic week my colleagues and I decided to head on down to Ping-Pong for some Dim Sum. While not as good as the free for all that occurs at The New World, Ping-Pong has one awsome thing going for it: the Jasmine Tea.

It appears as a unprepossesing green lump in an empty glass. Once the boiling water is applied a miraculous transformation occurs.

it doesn't look like much


the transformation is complete