Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: HTML::Template Vs Template Toolkit

by dsheroh (Prior)
on Sep 24, 2012 at 09:00 UTC ( #995316=note: print w/replies, xml ) Need Help??

in reply to HTML::Template Vs Template Toolkit

Once upon a time, I used HTML::Template for all my projects. Then I tried Template Toolkit and I've never looked back.

So, why do I prefer TT so heavily? Mainly because I use templates to decouple code from presentation and HTML::Template required me to build up huge swathes of code to provide every last detail that would appear in the presentation. When using TT with object-oriented programming, I can just pass off (usually) either a single object or a list of objects to TT and the template can inspect the object's properties to collect the information it needs. If a new property is added, templates have immediate access to it without the additional shim of adding code whose sole purpose is to make that additional data available for presentation.

Does this mean that I can also put method calls into a TT template? Yes, it does. But I don't. I don't turn on TT's EVAL_PERL option, either. I do put logic in my templates, but it is strictly display logic, which is a part of the presentation, not application logic. And, no, I can't say that I've ever felt particularly tempted to do otherwise.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995316]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2018-06-24 13:36 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.