Re: accessing template variables in perl code
Dave Howorth <dhoworth-fDajt2Yx3S8pY9vWkoisglpr/1R2p/[email protected]> Mon, 11 Nov 2013 11:51:09 +0000
| Newsgroups | gmane.comp.lang.perl.modules.template-toolkit |
|---|---|
| Organization | MRC Laboratory for Molecular Biology |
| Message-ID | <[email protected]> |
Stuart A Johnston wrote:
> You could wrap your function in a closure over the name of the template
> at the time you call process:
>
> my $template = 'template/name';
>
> $tt->process($template, { get_func => sub { get_params($template) } });
>
> Er, then again couldn't you just retrieve your data before you call
> process?
The function is also passed some arguments by the template, so that
won't work, I'm afraid.
Cheers, Dave