Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: HTML::Template Vs Template Toolkit

by dsheroh (Monsignor)
on Sep 24, 2012 at 09:00 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-23 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found