[Catalyst] Re: O’Reilly might yet be interested after all

A. Pagaltzis pagaltzis at gmx.de
Wed Feb 7 00:39:32 GMT 2007


* Fernan Aguero <fernan at iib.unsam.edu.ar> [2007-02-06 15:50]:
> And the typical beginner question would then follow: "OK, I see
> why you need a delimiter/marker ('[% %]') to tell TT which
> parts of the template should be processed, but what I just
> don't see is why I can't use standard Perl syntax within these
> delimiters!
> 
> i.e. instead of [% FOREACH item = things %] 
> why can't I just say [% foreach $item ( @things )  %]
> 
> instead of [% $item->name() %] why do I have to say
> [% item.name() %]
> 
> instead of [% $item =~ s/^(\w)\w+/$1./ %] why do I have to go
> and read the TT manual and/or purhase a book to realize that
> I have to write [% item.replace('^(\w)\w+', '$1.') %] ???

As I’ve written before on this list, templates consist of some
90% static strings, 9% very simple logic, and 1% really hairy
logic. So for templates, you want a language where static strings
are the default; with simple constructs to address the simple
logic; plus a real language for the remaining 1%.

I find TT more verbose than it could be for the simple cases,
yet far too weak for complicated logic. I’d prefer a template
language which has special constructs for looping and variable
interpolation that are concise and simple, but falls back to Perl
for anything beyond that. (And I’m gonna do something about that
desire at some point.)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list