[Templates] Modifying TT functions at run time
Simon Wilcox
essuu@ourshack.com
04 Nov 2002 14:37:31 +0000
All,
I am using ttree to generate html files, so all my extension perl glue
has to go into either plugins or [% PERL %] blocks.
I've successfully added a scalar op using $Template::Stash::SCALAR_OPS
but now I want to use a module from the CPAN and expose one of its
functions to my templates like [% imgsize(imgfile) %].
Normally I would pass this in as part of the %params to $t->process()
but I don't have that option. [1]
Is it possible to add a function like this at runtime or should I just
bite the bullet and write a plugin ?
Simon.
[1] Darren talked about the standard approach way back in Feb.
http://www.template-toolkit.org/pipermail/templates/2002-February/002633.html