[oak perl] Requests for Advise: Perl CGI or PHP?

Zed Lopez zed.lopez at gmail.com
Fri Dec 2 10:51:05 PST 2005


If you're working in Perl, check out Template Toolkit or
HTML::Template (the latter is probably a better idea if you're without
mod_perl -- TT is pretty hefty.)

That way you're neither putting (Perl) code in HTML or HTML in code.

Most web programmers (including me) will tell you that you're doomed
if you don't use a model-view-controller framework in which you
separate the presentation code (view), the navigation &
user/permissions/session management code (controller), and the
application logic (model). Using a template system enforces the
separation of view from everything else to a large degree -- it
becomes more difficult to intermix things in a bad way, so it acts as
an implicit reminder not to.

It's not that you can't have a good separation with Perl mixed with
HTML (Mason is one popular Perl web programming framework that does
just this), but it makes it easy to violate the separation without
even necessarily noticing you do so.

And it's not that I favor systems that hamstring you in an effort to
enforce good coding practices (I can rant at length at how tedious and
annoying I find Python, where that was a major design consideration),
it's that I haven't felt hamstrung in good template systems -- they do
a lot for you.

Of course, I've been out of web programming in Perl for over a year
and there could be some latest, greatest thing I've never heard of.
I'd be sure to do some research and to check out CGI::Prototype,
Maypole and Catalyst, for starters if I were to embark on some more.
(These are more controllers than template engines, or they were last I
looked.)

Perlmonks.org is a good place to search for info on this (or related
matters) -- you get a lot of commentary on things from people who've
been in the trenches.


More information about the Oakland mailing list