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

Michael Ruggiero mruggiero at formfactor.com
Fri Dec 2 11:08:25 PST 2005


I would echo that the Template Toolkit is a good way to get started with
this. The O'Reilly book will get you there.

I admit I occasionally violate the separation (creating tables in HTML),
a bad habit that betrays my need to refactor.  But when we changed site
navigation the other day, I only had to amend 2 template files and I was
done. Far, far better than debugging a bunch of routines that create
HTML as they go.

-----Original Message-----
From: oakland-bounces at pm.org [mailto:oakland-bounces at pm.org] On Behalf
Of Zed Lopez
Sent: Friday, December 02, 2005 10:51 AM
To: Oakland Perl Mongers
Subject: Re: [oak perl] Requests for Advise: Perl CGI or PHP?

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.
_______________________________________________
Oakland mailing list
Oakland at pm.org
http://mail.pm.org/mailman/listinfo/oakland



More information about the Oakland mailing list