There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
First and foremost, you need to do what makes the most sense for you and your project, taking into account the people currently working on it and the people likely to be hired to work on it in 2 years. If those needs are met by your function-to-html interface, then that's absolutely great.
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. My criteria for good software:
In reply to Re: The hidden charm of Template::Toolkit (and templates generally)
by dragonchild
|
|