[Chicago-talk] TT vs Mason

Jonathan Rockway jon at jrock.us
Thu Jun 15 14:43:11 PDT 2006

Actually, thinking about this a bit more, I think the ideal thing would 
be if TT let you put a nice block of perl code somewhere in the 
document, and then reference into it (as though it were a TTx).

Maybe something like:

[% CODE %]
use My::Module;

sub escape_uri : Filter {
    my $in = shift;
    my $out = My::Module::fix($in, "XHTML", "blah", "foo");
    return $out;

[% END %]


I'm not a big fan of the [% method.call(argument, another, blah) %], 
since I never know what's a bareword, what's a variable, what's a hash, 
what's a function, what's a scalar, etc. nor do I know where that 
variable came from (Catalyst stash?, earlier in the file?, TTx 
extension?).  Would anyone else like syntax like

[% $variable | escape_uri %]

(to call escape_uri with a scalar $variable, and then replace the [% %] 
region with the output of escape_uri)?

It would also be nice to autogenerate HTML as perl CGI, but with nicer 
(read: more maintainable) syntax than TTx::CGI.

I need to think about this some more.

...or maybe I just need to read up on Mason :)

Jonathan Rockway

Andy Lester wrote:

> My feeling is that Mason is more given to componentization, but it's  
> also more of a pain to deal with, IMHO.
> TT is also more abstract in the sense that it's not tied to web pages  
> like Mason is.  Mason can do generic templating, but it's more of a  
> pain.
> Personally, I prefer the TT metaphor of "pass some data into this  
> template" rather than the Mason "here's a template with code in it."

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 370 bytes
Desc: OpenPGP digital signature
Url : http://mail.pm.org/pipermail/chicago-talk/attachments/20060615/0a3631b1/attachment.bin 

More information about the Chicago-talk mailing list