Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Two tips for developing with HTML::Template

by Aristotle (Chancellor)
on Jan 11, 2003 at 19:56 UTC ( #226121=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Two tips for developing with HTML::Template
in thread Two tips for developing with HTML::Template

That reply doesn't make me happy. Why are you filling bits and pieces into the template here and there and everywhere, instead of accumulating the relevant data in one place during a first, application logic only phase, then passing that to the templating engine in a second, display logic only phase? Your tips themselves advertise intertwining the two, so I feel fairly secure in assuming that you are doing this throughout the rest of your code. I don't like that practice at all. Even in commandline scripts I try to keep all my prints together in one place as much as possible, not sprinkle them throughout the code.**

** Heredocs and (ab)using @{[ foo() ]} serves nicely as a poor man's templating engine.

Makeshifts last the longest.


Comment on Re^3: Two tips for developing with HTML::Template
Download Code
Re^4: Two tips for developing with HTML::Template
by dws (Chancellor) on Jan 11, 2003 at 21:16 UTC
    Why are you filling bits and pieces into the template here and there and everywhere, instead of accumulating the relevant data in one place during a first, application logic only phase, then passing that to the templating engine in a second, display logic only phase?

    Fair question. In the particular case I was wresting with, a page has separate logical components. The components are handled differently by both application logic and presentation logic. I could collect all of the template parameters together from the separate objects that deal with the presentation of each component, caching the parameters until I'm ready to set all of them in one big bang, but that seems like uncessesary work.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://226121]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2014-11-25 22:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (160 votes), past polls