Re: Accessing template variables after process
Andy Wardley <[email protected]> Wed, 20 Jun 2012 09:26:41 +0100
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Message-ID | <[email protected]> |
Hi Daniel,
> is there a way to access the (modified) template variables from perl script after calling process?
In short, no.
However, you can pass in a reference to a hash array that your templates
can modify. Your Perl code would look something like this:
my $exports = { };
$tt->process($file, { exports => $exports }) ...etc...
print $exports->{ filename };
And in the template:
[% exports.filename = "$somevar.$someextension" %]
Cheers
Andy