On Thursday 05 July 2001 15:41, Michael Bacarella wrote:
> On Thu, Jul 05, 2001 at 07:44:53AM +0000, Matt Sergeant wrote:
> > Yes, we do. But I don't think it's enough to convince people to move to
> > "mod_perl". They want to move to a better framework. I'm sure you know
> > which one I favour :-) Sadly most people *still* see Perl on the web as
> > CGI, as printing out your HTML from code, etc. It needs more articles in
> > the right places to fix that sort of misconception.
>
> What, there's more to it? :)
:)
> Using perl as an HTML generator does get pretty stale. Should I be
> looking into something else?
Whether you _should_ depends on the level of staleness you feel in using Perl
as an HTML generator. Perl is good for many more things than just text
manipulation, for instance it also has a host of facilities for dealing with
arbitrarily complex data structures and the such. Imho what is painful in
outputting HTML as if it were text is that it quickly becomes a maintenance
nightmare.
It also misses the fact that HTML is *not* text. It's just a tree.
Think of it this way. Your code, if it is even slightly complex, is actually
manipulating data structures (eg a list of search results). By treating HTML
as text, you're doing all the work of fudging data that was optimized for
processing (or should be) into something that can be displayed. We all know
how painful that gets when one has eg deeply recursive structures to display
that may have a variety of recursion cases at each level. Converting to text
is just useless coding overhead.
So if HTML (or most of whatever other ML you could output) is a structure and
what you're dealing with originally is a structure, why deal with the
intermediate text yourself ? It's only there for transmission, just like
network protocols and other things which you'd probably rather not have to
worry about when writing your apps.
The way I enjoy doing it is by putting my Perl code in modules, using XSP to
drive them (and thus to already have the structure mapped out trivially), and
to let XSLT deal with the conversion of the data structure into an HTML tree
and serialize it to send to the browser. Works like a charm, especially as
AxKit takes care of all the infrastructure and runs real fast now. I've now
forgotten HTML even existed, and I'm not ready to go back to it :) Without
going into a discussion of templating systems, how are others factoring out
the text overhead ?
--
_______________________________________________________________________
Robin Berjon <[EMAIL PROTECTED]> -- CTO
k n o w s c a p e : // venture knowledge agency www.knowscape.com
-----------------------------------------------------------------------
Oops. My Brain just hit a bad sector.