Catalyst Impressions

Ongoing thoughts on Catalyst, following from here. This is not meant to be a tutorial or a brochure – just observations and impressions that have been springing to mind and even there, things that really stand out. There’s a good chance I’ve misunderstood things or am simply wrong but figure it’s useful to capture it all somewhere. Also not attempting to fish for answers – want to see how far I can get without help.

  • The introductory documentation is good. Gives plenty to start playing around with. More is needed in the Cookbook IMO – although Catalyst leaves much to external CPAN modules, providing examples (esp. lots of form-related stuff) would help.
  • The controllers API is easy to remember – despite only having done some very basic stuff, the various special methods like begin, auto (perhaps that might have been better named chain?) and end are lodged in my head, along with the subroutine attributes for URL mapping like Global, Local, LocalRegex and Private. That’s in contrast to other frameworks I’ve tried, where there’s a need to keep returning to the documentation. Also the framework behaviour is easy to grasp – in conjunction with the Intro docs, this diagram says it all. See also the quick ref card (PDF).
  • Things like logging and testing being default parts of the Catalyst has been noted appreciatively.
  • Not 100% convinced yet by the skeleton code generators – while nice to have, passive generators like this make me a nervous – will there be a scenario where I want to re-run them for code that’s already been generated? So far can’t think of one.
  • Catalyst doesn’t seem to make a distinction between GET and POST by default; you’d have to look at $context->request->method – the documentation doesn’t reference this though and I wonder if that will lead to people writing code to handle forms which work via POST and get. Have a more general nagging feeling there about mapping URL’s (as in resource) to a single method. Best summarized by Why Do Web Server APIs Suck So Much? – Catalyst seems to have inverted the problem. Instead of bunding “a number of URIs (and therefore resources) into a single container”, seems like Catalyst splits up the URI’s nicely but then bundles all the HTTP methods down at single Perl class method.
  • Wondering about templates – will they be smart enough? Will be heading down the Template Toolkit path… In particular how do I access in the great URL handling knowledge I’ve embedded in my controllers? Have always found a prime source of bugs / later breakage is where there’s a mismatch between where a template is pointing a browser and what the controllers expect. Ideally would like the templates to work some of it out for themselves, along the lines of these in WACT. Also stuff like validation – plugging WACT again, it does an outstanding job of hooking up validation rules to template output for error reporting and other cool stuff like how one of these can automatically add a maxlength attribute to the appropriate form input field. Seems to be something approaching that in Catalyst – will see.

Anyway – more some time.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.