|Just another Perl shrine|
"Evaluating" TemplateToolkit variables.by techcode (Hermit)
|on Aug 16, 2008 at 18:04 UTC||Need Help??|
techcode has asked for the
wisdom of the Perl Monks concerning the following question:
I found out that eval does almost what I asked - except you need to include | eval which I would like to avoid if possible.
I looked before posting here and I didn't see - it seems that meerly asking a question unblinded me somehow - and this isn't the first time either.
The eval filter evaluates the block as template text, processing any directives embedded within it. This allows template variables to contain template fragments, or for some method to be provided for returning template fragments from an external source such as a database, which can then be processed in the template as required.UPDATE-END.
I need a way to evaluate/process TemplateToolkit variables from within a TT template. As in case of Process/Include when stuff "inside" is processed.
So in variable I have something like this, and it could also contain other TT directives:
In reality value for that is coming from a DB - so I can't simply place that in a BLOCK or external file. Ideas I have so far - but honestly, non of the solutions is optimal: