MVC Web Development with Perl
Perl has had many frameworks, some of them very old.
It used to be: Models - all logic and data, views - all presentation, controllers- generic mapping.
Now there is more flexibility, but the basic parts are still templates, data models, actions, and a uri mapping of some kind.
We're covering CGI::Application, OpenInteract2, and Catalyst. We'll see a sample application for each one, a pretty basic crud thing for on-line petitions.
There is a strong tradeoff between help and freedom - CGI:A most freedome, not much help, Catalyst is a medium, and OI2 give you less freedom for more asisstance.
CatalystInteresting url handling - you define subs that handle urls, and you have the choice of making them local, global, or private. These subs can be called from within your program as urls... or vice versa. What?
It has a few built-in urls/subs, default, begin, end, etc.
There is a $c "catalyst context" variable that gets passed around.
We're seeing one "main" file that defines what happens for each of the URLS. There was a grand total of about four subs in there.
It comes with a strange little debug server with which you can debug - it looks like this generates some very interesting meta-info as you click around.
The built-in crud stuff is very basic, and the class::dbi thing pulled in and made editable the timestamp field from mysql.
Okay - now we're looking at some custom code. We see a controller with subs like "list, view, sign". It looks very much like CGIs for the most part, with all the boilerplate stripped away, in terms of going to the "view" url, then being sent to the "edit" url, and then back to "list." The subs don't even handle their own data - the "Edit" one points to "edit?id=..." which matches on a regex i think?
He says that the low point of catalyst is the difficulty of figuring it out based on the docs.
CGI::ApplicationHelps you in the minimum possible way. The only CGI that runs is a totally
thin thing that instantiates an object and calls run() on it.
No layout help.
Model is via Class::DBI::Loader again - basically the same as Catalyst.
Once again - the main working file here just has some subs that act alot like CGIs. They're called "runmodes" in CGI::APplication
OpenInteract2oi2 does code generation with a central script that uses flags like "easy_app" to do automatic crud stuff. Sweet baby jesus, that build a lot of templated interaction.
oi2 boasts customization hooks even inside the automatic crud.
The code is much denser looking than the other ones. There's no provided stash for persistance data, so you handle your own, but there is a "context" style object.
Data Driven Testing
another one of these complex very personal strategies for testing.
Keep It Simple, Stupid
rioight.five tools you can't do without
sql translatormoves sql between idioms (mysql, oracle, etc). exports schema diagrams
http::simple::server::static - fires up a quickie webserver
Devel::Cover - gets coverage analysis. This is one of the things we got excited about earlier.
Pod webserver - neat. runs a server that aggregates some slick pod and source that you can browse locally
Perltidy - well, why not?
Pod::Coverage - oh we've got *this* handled! ;)
DBI::Shell - what? why not mysql client?
Module::Refresh - i didn't hear what this does.
YAPC Home