[Catalyst] sane migration to catalyst

Len Jaffe lenjaffe at jaffesystems.com
Tue Mar 14 19:43:03 CET 2006


Afterinnumerable software migrations, I can tell you
that you want to migrate piece by piece. 

I'll spare you all the long anecdote, but I will say,
that the fewer things you change at any given time,
the easier it will be to track down the source of the
new error.  One axis of change at a time.

Think MVC.  Think of your web app as:
1) messing with parms.
2) picking the biz logic to run (dispatcher)
3) running biz logic [C]
   i) manipulating data [M]
  ii) rendering output [V]

Since catalyst is going to handle a lot of 1 & 2, you
shoudl plan your migration based on 3.  Start by
picking a view, or a model.  

For Model, choose your ORM [CBID, or DBIC], get it
working, stand-alone - write the modules, and write
some Test::More code to exercise them.  Then make a
copy of one of your curent functions, and replace your
DBI calls with your ORM.

What you want to do is figure out what ORM methods
work best for replacing your current db access.

For View, pic one, and as above, make a copy of a
working page, and replace your current method of HTML
generation with it.

Once you've got the hang of your new ORM and your new
View renderer, your controller logic should be a snap
to convert into catalyst methods.

Now I don't know how your app is built.  If it is
DBI/CGI/print, then converting to an ORM will
probabaly be easiest/fastest.  Nothing feels as good
as success and momentum.  If you ar eusing print
statements, converting to a templating system may be a
bit harder or more complex/time-consuming.  There are
several good ones in Perl.  TT is very popular, and
for good reason.
Text::Template is also good, in a pure-perl-ish kind
of way.  You've no doubt also seen posts encouraging
you to adopt seamstress (no opinion, never used it),
and there's a HTML::Widget party going on right here.

My advice is also to stay in your comfort zone.  Pick
the view that looks like you'll be able to get your
work done with the least depletion in your headache
medicine supply.  You're shifting models.  While you
cope with a new model, you shouldn't try to cope with
a bunch of other new APIs at the same time.

Once you've adopted a Model, and a view, you're pretty
much MVC, you're just not using a cool framework. Now
you're home free. The catalyst examples are very good
at explaining the basics of controller logic.

I myself came to Catalyst with some CDBI experience
and and having used three different view modules, I
found it simple to get my prototype application under
Catalyst very quickly*.

Len.

[ * That was under solaris.  oddly enough, I can't get
a clean install of all of the catalyst stuff I need on
either of: fedora 3, cygwin, WinXP/ActiveState. 
There's always something that doesn't want to install.
:-)] 

Leonard A. Jaffe     lenjaffe at jaffesystems.com
Leonard Jaffe Computer Systems Consulting Ltd.
Columbus, OH, USA 614-404-4214 F: 530-380-7423



More information about the Catalyst mailing list