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!?
vote.yahoo.com - Register online to vote today!