in reply to The hidden charm of Template::Toolkit (and templates generally)
But, whenever I run into a question like this, I always turn to history. There is a reason why very smart people chose to make templating modules rather than function-to-X interfaces. And, I think it has to do with the X part in that last sentence.
About 5 years ago, I took over maintainership of PDF::Template. I did so because the PDF generation tool $work was using didn't scale appropriately. Now, P::T was very cool to us because it takes the exact same data structure that HTML::Template takes. This meant that the code that actually figured out what to do didn't have to worry about how the result was going to be rendered. It just had to come up with the data in some massaged data structure and pass that onto the View.
Skip forward about a year and I'm writing Excel::Template (and the aborted Graph::Template). All of a sudden, I'm able to render the same data structure into four rather different formats, all with a change of which module I'm instantiating. That's pretty darn powerful. And, it's something your function-to-X mechanism isn't going to support very well. That's why, I think, templating engines seem to be popular. They force you to create a proper interface boundary which, in turn, allows you to do really neat things for very cheap.
|
---|