Beefy Boxes and Bandwidth Generously Provided by pair Networks
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:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to Re: The hidden charm of Template::Toolkit (and templates generally) by dragonchild
in thread The hidden charm of Template::Toolkit (and templates generally) by roman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-19 12:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found