Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Keep It Simple, Stupid
 
PerlMonks  

Re: HTML::Template Vs Template Toolkit

by dsheroh (Parson)
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.


Comment on Re: HTML::Template Vs Template Toolkit
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995316]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2014-04-20 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls