Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

choosing the best templating system

by jbrugger (Parson)
on Jul 06, 2005 at 10:46 UTC ( [id://472750]=perlquestion: print w/replies, xml ) Need Help??

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

Hi all.

For a new web-application im trying to find out what the best templating system is to use.
The app follows the mvc pattern.
Right now i've looked at HTML::Template(::Expr), HTML::Template::Pro, ZM::Template and Petal.
I'm trying to find out what the pro's and cons are for these templating systems, and why i should prefer one over the other.
Any suggestions (and experience) with these?
thanks again

Update
Thanks for the reactions, for now i'm convinced to use Petal, i only don't know the memory usage of it yet...
* Internationalized (i18n) * The template can be viewed in any browser / editor, the petal ta +gs are embedded in the html-tags. * Straight forward (small learning curve when used to HTML::Templa +te) * Petal provides a mini-language * Petal is xml-based, which is fine if you have well-done XHTML. * It's pretty mature and has an active community. * Installable with apt-get install libpetal-perl * The HTML beforehand is well formed, includes sample values for t +he dynamic parts and all you have to do with Dream weaver is apply st +yles to the sample data and all will be well. At template compile tim +e, all the sample data is discarded and then at run time, the real da +ta is inserted. Cons * The thing that takes the most getting used to is that it's a lit +tle verbose. Unfortunately this is a necessary side effect of being t +ruly compatible with XML/HTML.


"We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

Replies are listed 'Best First'.
Re: choosing the best templating system
by Fang (Pilgrim) on Jul 06, 2005 at 10:56 UTC
Re: choosing the best templating system
by gellyfish (Monsignor) on Jul 06, 2005 at 11:00 UTC
      Thanks, i allways forget this option...

      "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re: choosing the best templating system
by samtregar (Abbot) on Jul 06, 2005 at 14:54 UTC
    I've done a fair amount of work with Petal recently on the MKDoc project. In general it's a pretty neat system, but it does suffer from some signficant drawbacks:

    • Terrible error messages. If something goes wrong you're pretty much left on your own to figure out what it was.
    • XML was never meant to be edited by hand, a fact that will become painfully obvious if you try to edit your templates in a normal text editor!
    • It's quite slow. I've seen cases where relatively simple templates take several seconds to process for no obvious reason.

    -sam

    PS: Of course, no discusssion of templating would be complete without a pointer to the article on the subject, Choosing a Templating System by our own perrin! Ignore it at your own risk.

      Would you mind telling me a bit more about the drawbacks?

      On what machine were you running, how was the memory usage of the module? what version were you running, were you able to fine-tune or cache the templates?

      Would you suggest another systen then Petal, since it's not mentioned in the other nodes that go about this subject, and the fact that it's supporting international (i18n) makes it interesting for me, and i'm quite charmed by the way the tal-tags are implemented in the xhtml-tags. Till now i allways was using HTML::Template and HTML::Template::Expr.

      The newer HTML::Template::Pro i wanted to trt did not compile on my machine however.

      "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
        On what machine were you running,

        Fedora Core 3 running under VMWare on Windows XP SP2. The machine is an AthlonXP 2500 with 756MB of RAM.

        how was the memory usage of the module?

        It's hard to say. MKDoc is generally a memory-hungry system so it's not easy to say how much Petal contributes to that.

        were you able to fine-tune or cache the templates?

        I didn't spend the time. In this case a few seconds was acceptable.

        The newer HTML::Template::Pro i wanted to trt did not compile on my machine however.

        Gee, that's too bad. And I thought it was supposed to be the professional version! ;)

        -sam

Re: choosing the best templating system
by crenz (Priest) on Jul 06, 2005 at 11:48 UTC

    Just to confuse you more :-), Mason would be another option, and of course Maypole, the new MVC kid on the block.

Re: choosing the best templating system
by BaldPenguin (Friar) on Jul 06, 2005 at 14:47 UTC
    I myself go for XML/XSL either with AxKit or a streamlined version of my own using XML::LibXML.

    Don
    WHITEPAGES.COM | INC

    Edit by castaway: Closed small tag in signature

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-25 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found