Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Is there not a way to set variables within a Template between the time you call new() and the time you call process(). I am in a mod_perl environment, so my Template object is created once at initial startup. I have an init() method I call upon each request and I need to set several Template variables within this method. This init() method takes place long before the process() method on the Template object is invoked.
Looking through the Template docs, I am not seeing any $tt->param(foo => 'bar'); or anything similar. All I see is the VARIABLES/PRE_DEFINE keys you can pass to new() and the variable hash you pass in process(). Looking through Template's code, the variable stash ends up being handled via XS, so I can't determine how to hack the internals. Am I stuck simply setting my own global stash within init() and then including that stash in my call to process()?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Template Toolkit - Setting variables between new() and process()
by merlyn (Sage) on Feb 27, 2004 at 21:31 UTC | |
by Anonymous Monk on Feb 27, 2004 at 21:38 UTC | |
|
Re: Template Toolkit - Setting variables between new() and process()
by perrin (Chancellor) on Feb 27, 2004 at 21:11 UTC | |
by Anonymous Monk on Feb 27, 2004 at 21:24 UTC | |
by perrin (Chancellor) on Feb 27, 2004 at 21:31 UTC |