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

I just heard about ClearSilver today. It is Yet Another Template System, but it has some interesting things such as being language-neutral and including a Perl API. Has anyone here tried it and has good or bad experiences to share?

The documentation includes an interesting comparison of various different templating approaches, including popular ones such as PHP, JSP, Template Toolkit, Mason, and HTML::Template. Interestingly enough, the page is called Apples to Oranges. ;-)

No, this is not a paid advertising; it's just curiosity.

Replies are listed 'Best First'.
Re: Anyone here has tried ClearSilver?
by fergal (Chaplain) on Nov 25, 2004 at 13:23 UTC

    Looks like yet another embed funny tags in your html style language, nothing particularly new.

    The only system I've seen that's in any way different has been Zope's TAL. It takes a little bit of getting used to but your template will be perfectly valid HTML/XML and can be worked on GUI web editors etc and will look reasonably well while being edited. An example is

    Hello <b tal:content="user/name">Mr Sample User</b>

    When you preview this, you will see Mr Sample User in bold and when you execute the compiled template you pass it in a hash and it will pull out $hash{user}{name} and put it in the right place.

    It's very much a data presentation language, you have to prepare all your data beforehand and then give it to the template (although your template can call methods as well as access hash and array elements, so you can generate the data or pull it from the DB on the fly). This is a little restrictive but it actually helps you to better separate presentation from logic.

    There's a Perl implementation called Petal

      That petal-module looks pretty cool to me. Haven't seen it till yet. We use Zope in our office so it's nice to be able to use the same templating-syntax in my prefered language - no, that's not python ;)

      neniro

Re: Anyone here has tried ClearSilver?
by Anonymous Monk on Nov 25, 2004 at 08:29 UTC

    Havent tried it, but a quick glance of the links you provided makes it look like what ColdFusion did in 1996. The goal to

    support the separation of the HTML presentation from your application logic
    is nothing new and ClearSilver (in terms of syntax) does not appear to offer anything innovative, nor anything that cannot already be done with native Perl, or the myriad templating systems available therein.

    As far as "language-neutral" ... there is no such thing. That's marketing-speak for "learn a new mini-language on top of the one you are already using". ClearSilver does not appear to offer anything remarkable that isn't already available.