hmm... not sure about that...
If your TMPL_IF takes one branch which doesn't result in generating output, why didn't the Perl code test the same value and not generate the unused H::T param data?
----- Original Message -----
From: Bob Diss
Sent: Wednesday, October 06, 2004 11:01 PM
Subject: [htmltmpl] Allow coderef's for LOOP variables

My templates tend to be pretty complicated, and often have different If/Then/Else paths that they could follow when rendering.  I also have loop objects which are expensive to build (time-wise).  Therefore, I query() the template only build them if the template references them.  However, this didn't give me the best performance savings, because often the template would still not use the expensive loop object, because it didn't follow that If/Then/Else path.
To "fix" this I arranged for my expensive loop object to be built as a call-back, and stored a coderef as the param value.  However, I found that HTML::Template didn't allow code references for loop variables.
I implemented the work-arounds for this by allowing a loop variable to be a coderef, and then detecting it later and de-referencing it at output time.
What are the thoughts on doing this?  It does weaken (or at least postpone) the strong type checking that occurs for a loop value (must be an arrayref).
-Bob Diss

Do you Yahoo!? - Register online to vote today!