Template-Toolkit reviews

cpanratings
 

RSS | Module Info | Add a review of Template-Toolkit

Template-Toolkit (2.24) ***

Template toolkit is the MySQL of Templating Systems. It does the job as long as you don't want too much sophistication.

It's good for non-developers to maintain simple things, like message templates for instance. And it's very easy to have it to fetch templates from different sources (like your DB).

Except that, the syntax and the behaviour is not consistent with what we're used to in Perl, making it a poor choice for us Perl developers. Unless you feel confortable with switching to a much less powerfull and much more confusing language when comes the time to write your View components.

Template-Toolkit (2.22) *****

Template Toolkit is the best template engine I have ever used!

Template-Toolkit (2.20) *****

Template Toolkit is the king of the templating systems on CPAN. It has everything and then some - is very convenient, very intuitive and very powerful. Everytime I have to use HTML::Template in someone else's code, I keep missing the power and usability of Template Toolkit.

I can highly recommend Template Toolkit for all your templating needs. Don't settle on a lesser template system, because you'll eventually outgrow it.

Template-Toolkit (2.19) *****

CPAN is notorious for the number of different templating libraries available to let you insert dynamic content into static content. Template-Toolkit (aka TT) is the best of breed, in my opinion. I've tried a lot of them and, I'm embarrassed to say, even published my own template implementation.

The features that I like about TT are:

* It has a syntax that's just powerful enough to do complex presentation, but is deliberately not Perl to discourage you from writing real code in it.

* It compiles to real Perl code which makes it quite fast despite the complexity of it's syntax

* It has a fairly easy interface for adding new "VMethods" and plugins

* It has nice filter methods to let you do like so: [% var | html %], which lets you escape "<", ">" and "&" trivially. You can "pipe" your output through an arbitrary number of pluggable filters.

The biggest flaw in the implementation, in my opinion, is that all virtual methods are called in list context, even when it looks like you are working with scalars. This can produce surprising results when working with code that does "wantarray" tricks. For example you would expect the typical DBIx::Class code to count the number of database records would be: [% model.search(...).count %]. But, search() happens in list context so it returns rows instead of a ResultSet instance. Instead, you have to remember to write [% model.search_rs(...).count %] to force scalar context.

Template-Toolkit (2.19) ***

Template Toolkit is the dominant templating module for Perl, and at a functional level deservedly so.

Unfortunately the author's packaging of this module is highly substandard.

It routinely and randomly breaks on Win32 for months at a time because of weak release testing. When it does break, fixes can take a long time to appear.

Further, it ships with a (fast) C stash that cannot be independently installed after the main distribution, and by default it also ships with an enormous and unrelated HTML GUI toolkit that almost nobody uses, and introduces a number of problems and issues unrelated to the main code.

This is the tragedy of Template Toolkit, that it is by far the best templating module, but the packaging is so annoying.

Template-Toolkit (2.19) ***

TT2 is a that allowed me to turn a lot of my old, horrifying code into nice, simple code. Abstracting logic from presentation is all well and good in theory, but without a really good templating system, it just doesn't happen. TT2 was able to do everything I needed, and sometimes made me see new and better ways to break my code into little tiny pieces.

Despite that, it's got a number of big warts, including the lack of an undef value, the lack of context when calling context-sensitive methods (or subrefs), and its obnoxious scoping system.

While these limitations don't show up at first, especially when using code that's been written with TT in mind, they become more and more painful as time goes on.

There are a few reason to use template language that isn't the same as your programming language. The most important of these is simplicity for non-programmers and re-use across multiple languages. I don't find TT to be much simpler than baby talk Perl, although it is a bit simpler, when the stash is made to contain only things that can be used simply in TT. TT isn't well implemented in any other language, so that benefit isn't here.

I find HTML::Mason's template langauge and Text::Template to be much more useful for my needs.

Template-Toolkit (2.19) *****

Put simply Template Toolkit has saved me an immeasurable amount of time and grief over the years. An absolute must have tool.

Template-Toolkit (2.19) *****

I finally got around to converting a simple web site to Template Toolkit. Wow, I should have done it long ago. Makefiles + ttree make managing a multi-page static site a breeze. I haven't yet used it to maintain a more complicated site with Perl cgi scripts and such, but that will be my next test of the tool. My only (minor) criticism of the TT is that it has a *lot* of configuration and processing options. The good thing is that I don't have to use them all. I've been reading a lot about template systems and the theory behind the java-based StringTemplate system. The author of StringTemplate makes a good case for not getting too wrapped up in overly complicated templates which would be easy to do with TT. Overall I give TT a thumbs up.

Template-Toolkit (2.19) *****

Hands down this is probably the single best library on CPAN.

I started web development with the attitude of "I'll just roll my own template system with regexes" and "why create another mini-programming language when you already have perl?".

Let me tell you something. I was wrong. My regex's sucked, my home-brew cache code was buggy, and the way the templates were stored (in the database) made version control a nightmare. Template::Toolkit and it's family of plugins have stripped out all the wastefull, trivial, ugly loop crap (i.e. a for() loop for a bunch of <select> options) in my codebase and moved them into very elegant templates. My perl codebase was literally cut in half.

Once you see what a template library like this one can do to your code, you'll wonder how you ever did web applications before. Trust me, you dont know how to roll your own template language. You dont have the time to piss away rolling your own cache code and no matter how hard you fight, the ability to do simple loop or conditionals in your templates *is* the right thing to do.

What does my rambling say? Template Toolkit rocks!

Template-Toolkit (2.19) *****

Just tried Template::Toolkit after using HTML::Template for a fair while. H::T is good, but got in my way a little (especially when wanting to loop through an array - having to turn that simple array into an array of hashrefs was annoying).

Got T::T installed and converted over a (admittedly fairly small) project to use T::T within about half an hour and... my God, it has no right to be *this* good :)

Template-Toolkit (2.15) *****

I can't believe it took me this long to get around to reviewing this. It's all been said already so I can only add: When I'm doing a new project I'm never sure exactly what framework, family, approach, or logic I'll settle on using but the templating language is never in question. It's TT2.

Now, where's my TT3, Andy, you slacker? Kidding!

Template-Toolkit (2.14) *****

I recently started using Template Toolkit (TT) after being a long time HTML::Template (H::T) user. I had started using Catalyst and a discussion on the mailing list convinced me to try TT. I found several TT benefits that have made a big difference in cleaning up my code. I use TT as the View for Catalyst. I've used HTML::Template with Catalyst, CGI::Application and stand-alone.

H::T has a philosophy of strong separation of layout and logic. Using TT with a web framework allows a philosophy of separation of business logic and presentation logic. For a site with complex presentation logic, the H::T approach leads to placing that logic in the application code. TT's functionality allows presentation logic to be put in the template, and business logic in the application code. My application code has become much more streamlined and easier to follow using TT with Catalyst.

The primary benefits I've found so far are:

(1) Complex Perl datatype support: Perl data structures and objects can be delivered directly to the template without reformatting to the template language. In a MVC framework, it also allows data from the Model to be sent to the View without reformatting. This information is accessed by TT's "unified dot notation" and eliminates a lot of code and improves readability.

(2) Rich template language: Display logic can be moved into the template and separated from the business logic. Wrapper, complex if/elsif conditionals and join have been useful so far.

(3) Framework context object access: When used with a framework such as Catalyst or CGI::Application, TT templates can access context data and methods thus eliminating code in the application whose sole purpose would be to take variables and insert them into parameters. With Catalyst, TT can access plugins such as FormValidator, FormValidator::Simple, Prototype, etc. With CGI::Application, TT can access the HTMLPrototype plugin using CGI::Application::Plugin::TT. The ability of TT to access the framework context object is a big incentive to use framework wrappers for CPAN modules instead of using the modules directly.

These features have all contributed to simplifying the application code which is important in a large application. I'm still fond of HTML::Template for it's simplicity and easy installation but for large/complex web applications, Template Toolkit provides substantial maintainability benefits.

NOTE: This review compares TT with the base H::T distribution. To address concerns with H::T, there are some variations of and extensions to H::T that provide additional functionality, some of which is similar to what TT offers. TT-like access to nested method calls and hashrefs can be provided by either: HTML::Template::Plugin::Dot or HTML::Template::Compiled. At the moment, H::T::Plugin::Dot requires H::T::Pluggable while H::T::Compiled uses a slightly different API and lists it's object rendering feature as experimental. Context object access will be available using H::T::Plugin::Dot via CGI::Application::Plugin::HTDot in the future. Expression support is available via HTML::Template::Expr. Additional versions include H::T::Pro and Matt Robertson's version with enhanced functionality available at: members.optusnet.com.au/~mathew/html_... . I appreciate the efforts to enhance H::T, however I hope the base H::T distribution can incorporate some of the more popular features so the code will not become fractured requiring people to use code that is less widely used, tested, and patched. With multiple distributions, it's also uncertain if any change to one will propagate to others in a timely manner.

Template-Toolkit (2.14) *****

I wish all modules on CPAN were as superb as the Temlate-Toolkit. Easy to use, yet extremely powerful and extendable. One can build a whole framework around it in hours which can beat most similar, "modern" systems such as JSP. Start using it and you will never want to use any other templating systems!

High fives!

Template-Toolkit (2.13) *****

HTML::Template doesn't compare. The Template Toolkit runs all my sites.

Template-Toolkit (2.10) *****

Love it, love it. I have a friend who curses it's existence, in favor of Mason (though I recall it was he who first told me about TT2). So I guess you either love it or you hate it. I love it. Complete separation of business and display logic. Very smart code that behaves just as you expect it to in almost all cases. I agree with a previous user that I would like to see it speed up, but I also realize it's got a lot going on.

Template-Toolkit (2.10) *****

TT2 strikes that Zen point of being incredibly powerful, while being trivially simple to use. The documentation is incredible, the templating syntax just right, and the implementation is some of the best, most functional OO perl I've ever encountered.

Whenever I'm using a different template system (e.g Velocity, or Cheetah) I always miss TT2's advanced features like wrappers, and macros, and its super clean "unified dot notation" for accessing the variable space.

Template-Toolkit (2.10) *****

I love TT and use it for Slash and other projects. It could be a bit faster -- not merely in the template execution, but just in the process of selecting the right template for execution in the first place -- and the vast, very good, documentation could be easier to navigate.

Template-Toolkit (2.10) *****

This is the template system you want to use if you need power but want your templates and your perl separate. It makes it easy to enforce some discipline. (Although, of course, you can make it all too lax if you want). And with a plugin sytem and an easy interface, it's super nice to use.

Template-Toolkit (2.10) *****

Powerful enough to get the job done. Simple enough not to get in your way. Very easy to customise. My favourite templating system.

Template-Toolkit (2.10) *****

The Template Toolkit rocks! Useful for all sorts of things (not just web pages), very powerful, lots of useful plugins, great documentation and actively supported.

The biggest complaint is that it's 'too powerful' - it *allows* you to embed Perl code in a template that would be hard for a non-programmer to maintain. Well duh! if non-programmers are going to maintain your template then of course you shouldn't put program code in there - no one's forcing you.
2 hidden unhelpful reviews