On Wed, May 9, 2012 at 2:30 PM, Paul Wallingford <p...@cybergestalt.net>wrote:

> An example of a slow method would be a parser that breaks of the final
> output into a DOM tree and can apply escaping to the right parts.
>

That assumes that there is a DOM tree to be parsed.

An example of a method that preserves context is the CGI module.
>

Or a CGI environment.

Essentially, if you want something not escaped at all, use $m->print, such
> as for generating cron files or Apache configs.  If you want web escaping,
> use $m->html.  Embedded Javascript could be $m->javascript and so on.
>

This defeats the entire point of a template language.  If I have to call
methods to DWIM, I might as well write it all in raw Perl code.

Note, again, that Mason is a *general-purpose* template language, not
necessarily a *web* template language.

I think the default for text outside a <%perl> block should be HTML style
> escaping, since it seems that most Mason2 apps are web apps and most
> non-web Mason2 apps would need some sort of Perl to generate their output
> (and there is always the here-doc for boilerplate text).
>

One thing I've (ab)used Mason for in the past is dynamic generation of
kickstart configs for Fedora network installs.  There was a minimal amount
of Perl in an <%init> block, and the heavy lifting was handled via Mason
template inheritance.  No <%perl> blocks at all, and I shudder to even
think what that would have looked like had it been a requirement.

Actually, it probably would have looked like Template Toolkit, because that
sort of onerous requirement would have made Mason the Wrong Thing for the
project.  (And perhaps it was anyway, but I like to think the final product
was quite elegant.)

Don't assume that people have done it your way. TMTOWTDI, after all.

-- 
Stephen Clouse <stephenclo...@gmail.com>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to