You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Perrin Harkins <pe...@primenet.com> on 2000/12/31 19:45:33 UTC

Re: comparison of html/perl methodologies

On Sun, 31 Dec 2000, Paul Phillips wrote:
> Now, I'm interested in looking at web authoring from the reverse 
> perspective - embedding Perl in html.
> 
> A quick look tells me that there are a number of possibilities out there --
> Apache ASP
> Mason
> Embperl
> HTML::Template
> 
> There are probably some others as well...

Our numbers are legion.

> After having looked at their respective web sites, I seem to be having 
> trouble understanding how these are different from one another and their 
> relative strengths and weaknesses.
> 
> Would anyone care to take a stab at making some kind of summary of 
> distinctive qualities, goals, etc.

I'm writing just such a document, but it's not finished.  For now, look
in the mailing list archives for previous discussions on this topic.

A couple of words of advice:

If this is a very simple site that will be worked on by one person and
will not change it's look very much, it doesn't matter which one you
choose.  Just grab whichever one looks like the most fun or the easiest to
get started with. 

If this is a bigger project that involves multiple coders, HTML-only
people, or will change it's look often, your work will be easier to
maintain if you keep a good separation between the "application"  code and
the "presentation" code.  This is in contrast to the PHP style of putting
all your code in-line in the HTML. 

You can do this kind of separation with just about any tool.  Mason,
Embperl, and Apache::ASP can do this by putting your code in modules which
you call at the beginning of the template and then use the results of.
(Well, they each have their own special ways of supporting this as well,
but it amounts about the same thing.)  Your templating constructs (loops,
conditionals) will be written in Perl in-lined in HTML.  HTML::Template
and Template Toolkit generally expect you to write a CGI or modperl
handler that will do some work and then run the result through a template.
The templating constructs are done with a mini templating language when
using these modules.  The basic question you have to answer is whether or
not the people who have to edit the "look and feel" part of your templates
will be happier and more productive using in-line Perl or one of these
templating languages.

If you're building a larger project and want some help figuring out how to
organize it, take a look at Apache::PageKit, which provides a skeleton for
developing applications using HTML::Template.  I use a homegrown system
which is very similar in spirit but works with Template Toolkit, which I
prefer. 

Hope that gets you started.  There's tons more in the archives.

- Perrin