2008/12/16

Organizing My Thoughts on Catalyst

I am about three hours from presenting on Catalyst for my Perl Mongers meeting.

For those who don't know, Catalyst is a Web Framework using the MVC (Model-View-Controller) format to make for easier web development.

Imagine the operators that you see sometimes in 1930s movies, or in old reruns of Laugh-In. The Model is the trunk line with people with information trying to connect in. The View is the person in Suite 14 receiving the calls.

The Controller, Catalyst and the code you write for it, is Lily Tomlin.

Up in Suite 14, running the View, is Template::Toolkit. I've never had reason for templating before, but I'm learning to like it. It's a powerful tool. The institutional view here in the subbasement is that you should limit the amount of logic you put in the View, doing all that mess in the Controller.

The Model is DBIx::Class, and the more I deal with it, the more I accept it as a powerful tool. I have been saying that Catalyst has made it hard for me to leverage the awesome power of SQL, but today I have been beating my head against the switchboard and whipping myself with patch cables, trying to do two simple things. If I get those two things done, I can use one View, one Template Toolkit file, with Catalyst

First, we have lastname and firstname, but we want name = firstname . ' ' . lastname . Unless there is no firstname, in which case name = lastname.

Next, each person does something, and there's a table showing each time that person did that thing. We want to count each thing and establish count.

I can do that. I can use DBIx to get all that information. What I cannot do is put the genie back in the bottle. Or, I cannot patch it back into the View.

Which means, LOL fashion, that I'm doin' it wrong.

So, I'm off to read up on DBIx::Class, and there's next to zero chance that I'll be able to get this work before Perl Mongers.
Post a Comment