Hi all,
Each template output format has some kind of variable preprocessor (see
https://github.com/ledgersmb/LedgerSMB/blob/master/lib/LedgerSMB/Template/LaTeX.pm#L76) which walks the entire hash of values passed to the template to escape the values appropriately for the given output format (e.g. HTML escapes & to & et all.).
As can be seen by the reported problem running LedgerSMB on mod_perl2, this is error prone: the walker ran into an object of a type that was unknown to it (Apache2::RequestRec). Additionally it seems rather inefficient to walk the entire hash and encode all values when we usually don't use all values anyway.
Some months ago, I found that we can hook into Template Toolkit's variable-value-getter:
http://template-toolkit.org/docs/modules/Template/Stash.html#method_get . When we wrap the 'get'/'set' methods, it seems we can be much more efficient at encoding. Also, since the Apache2::RequestRec value was stored in a field which isn't ever being accessed, running on mod_perl2 would have worked out of the box.
I'm thinking we should move to cleaning up variable escaping in the Template/*.pm format files and use the Stash wrapper. Comments?
--
Bye,
Erik.
Robust and Flexible. No vendor lock-in.