in reply to They do different things! (was Re: 1001 CPAN Template modules)
in thread 1001 CPAN Template modules

Hugh, i am really overwhelmed by the negative comments. Seems like the idea is somehow insane. May be i am to primitive when thinking about templates.
But why do they all have the "template" in their name. I am sure they must have something in common.

Initially one could ignore all the superpowers of TT's and ??'s and concentrate on the core "beeing a template" thing.


Something on CPAN already?

Murat
  • Comment on I am sure they must have something in common.

Replies are listed 'Best First'.
Re: I am sure they must have something in common.
by Corion (Patriarch) on Apr 22, 2004 at 12:33 UTC

    If you want the training wheels without the bike, you can start with the lowest common denominator, but that will compell nobody to switch from their templating system to your backend system.

    For most people, their templating system "just works", and depending on the application, one templating system is more suited than the other. But you don't gain much benefit of making the templating frontend interchangeable, as people usually don't switch templates, and even if switching templates, any such switch will involve changes in the driving software anyway.

    The only thing that could possibly be saved would be that one doesn't have to install yet-another-templating-package just to support the new templating syntax, but if an application switches its templating system, that's a minor point anyway.

    DBI is different, because it makes the backend exchangeable for an unchanged frontend. Your abstract templating idea tries to make the frontend and input data exchangeable, but changing the frontend and structure of the input data is not something you do on a whim or have as difference between development and produciton environment.

    You can compare an SQL statement to a template, and the DBD is the templating engine. But with DBI, you feed it always the same statement, only the transformation for the backend differs. With your solution, you feed it different input to create the same output - this sounds more like different programs than something that should be solved by plugins.

Re: I am sure they must have something in common.
by dragonchild (Archbishop) on Apr 22, 2004 at 12:27 UTC
    You are very naive in your thinking about templates. Yes, they do have a very basic function in common, which is to take a layout and a set of variables and produce something with those two things. However, templating is a much more complex task than communicating with a database (which isn't trivial).

    I wrote and maintain PDF::Template, Excel::Template, and Graph::Template. They're designed to work with HTML::Template. When I started looking at TT, I wanted to reuse those modules. Then, I realized that what I was trying to do was hopeless. The data structures used are so different and the expectations of the client are different.

    Now, TT may be what you're looking to use. It is an attempt to make using templates very generic and extensible. H::T was written a long time before Template Toolkit. (Correct me if I'm wrong, but wasn't TT a response to H::T's deliberate lack of features?) Just because it isn't the DBI of templates doesn't mean it doesn't do what you need. And, there's a book on it, too! :-)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

      TT started out as Text::MetaText quite some time ago (~1998?) and drew no inspiration from HTML::Template. In fact I was under the opposite impression, that HTML::Template was a response to the large TT :-)

      Chris
      M-x auto-bs-mode