The hidden charm of Template::Toolkit (and templates generally)by roman (Monk)
|on Jan 06, 2008 at 20:02 UTC||Need Help??|
roman has asked for the
wisdom of the Perl Monks concerning the following question:
i am about to do some web programming in Perl, so I started to learn about Catalyst and MVC. I have some previous experience with HTML::Mason, but Catalyst uses Template::Toolkit as the first option for view components.
Why? Why is it worth to use (and learn) a different language for the template? I ask, I don't argue, because obviously many people dot it and someone even presented TT as a standard tool for web page development at Vienna.pm lightning talks.
So far I found only 3 reasons hardly applicable in our environment:
Am I wrong? Is there any other - sound and general reason to prefer TT from Mason?
But even If HTML::Mason is the appropriate choice for my environment I can go a bit further. Why to use ANY template engine at all? Why don't use ordinary Perl for the view components?
Everytime I tried a template based development (Perl + HTML::Mason and a bit of PHP + Smarty) I ended up with quite a messy template with lots of iterations and conditions intertwined with plain text.
Where is the advantage of mason template:
over Perl code (I use fictional function-to-html interface, I believe there must be plenty of them)?