http://www.perlmonks.org?node_id=20514

markjugg has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm in the processing of choosing a templating system to abstract the HTML design from my perl code in my web-based software project, Cascade ( http://www.summersault.com/software/cascade ). There are a lot of options for Perl templating modules. What do you all recommend and why?

Replies are listed 'Best First'.
Re: Best templating system?
by btrott (Parson) on Jun 30, 2000 at 03:15 UTC
    I've used Embperl and Mason. Both have their advantages--Embperl has a lot of neat HTML tricks it can do automatically, like filling in forms with sticky values, and dynamically constructing tables for you; Mason has a more extensible interface, I think.

    And it's for this last reason that I like working with Mason better. Its OO design makes it very easy to extend certain pieces; for example, by default it pulls the "components" from the filesystem. But you can override this and write your own code to instead pull the data from another data source, like a database. Which is very nice. I also like Mason's caching support better.

    PerlMonth has articles about using the various templating systems. You might want to take a look there and see if a particular style of templating appeals to you more. And of course, the best way to see which one you like is just to try them out.

      HTML::Embperl has the same component-based system in its newer versions.. Check out EmbperlObject
Re: Best templating system?
by chromatic (Archbishop) on Jun 30, 2000 at 06:19 UTC
    I've used Text::Template and Template (template toolkit) in a current project. The former is nice, and easy to use, but it died under Taint mode. It's not on my list for web pages anymore.

    The latter is almost as easy to use, though it has some strange syntax. If you're going to do PHP-like pages, it's a definite possibility. It's not too complicated, so it's easy to start with. (It may not scale as well as Mason, though.)

      Could you provide examples of what you consider to be Template's strange syntax?
Re: Best templating system?
by infoninja (Friar) on Jun 30, 2000 at 03:52 UTC
    I'd also recommend CGI::FastTemplate. I've used it a lot, and I'm quite partial to it.
Re: Best templating system?
by httptech (Chaplain) on Jun 30, 2000 at 06:55 UTC
    HTML::Template is nice; it supports loops and includes as well as normal template tags.
an opinion on templating systems
by Anonymous Monk on Jun 30, 2000 at 08:00 UTC
    Here's an article giving one person's opinion about several different templating modules.
      That's a neat little write-up. I would caution, however, that the table of features is inaccurate for the current implementation of HTML::Template if not for the other modules as well. A lot changes in a year.
Re: Best templating system?
by Anonymous Monk on Jul 01, 2000 at 02:37 UTC
    I am using HTML::Template and I have to say, it is working fantasticly for me. The html code and the perl code is totally seperated and that is a Good Thing(tm)! The web designer can do what he/she likes without worrying to much and I don't have to worry about perl code in web pages that I might have to update.