Thursday, April 3, 2008

Learning to play with Catalyst

Yeah, I know I haven't posted in three weeks, almost. So sue me. :)

I just got a job developing a web application in Perl. And since all the cool kids are using Catalyst for web development these days, I thought I'd jump on the bandwagon.

So this thing I'm developing has an Oracle backend. First of all, let me say that Oracle has been regularly pissing me off for various reasons. Chief among them right now is the 30 character limit on identifiers, so if I name a constraint (which is a good thing to be doing) it has to be under 30 characters.

Anyway, Catalyst has this nifty bit whereby it will automatically generate table classes, or "source classes", in DBIC parlance (for use by DBIx::Class::Schema) for you. And this is really cool and timesaving. However, it does not, so far as I've been able to tell, automatically populate the hash generated by DBIx::Class::ResultSource->column_info from the table structure in the database. That bit you have to do by hand, unfortunately. It will do constraints, however, which makes up for that in part. One thing to note about constraints - you have to access the constraints by their names, not by the columns they're defined on. So if you have a table with a field 'login', you can't specify {key => 'login'} in a call to DBIx::Class::ResultSet->find. It took me a good half day to figure that one out. :)