[Templates] Modifying TT functions at run time

Perrin Harkins perrin@elem.com
Mon, 04 Nov 2002 13:38:03 -0500


darren chamberlain wrote:

>* Simon Wilcox <essuu@ourshack.com> [2002-11-04 09:38]:
>  
>
>>Is it possible to add a function like this at runtime or should I just
>>bite the bullet and write a plugin ?
>>    
>>
>
>Nothing springs to mind that would help you -- a user can't load
>arbitrary Perl modules into a Template unless USE_PERL is set in the
>Template constructor (security feature).
>

I don't see any problem with enabling it when using ttree, but it won't 
help since Image::Size doesn't have an OO interface.

Of course since you're already using Perl blocks for your other setup 
work, you could just do this:

[ % PERL %]
  use Image::Size ();
  $stash->set(imgsize => \&Image::Size::html_imgsize);
[% END %]

- Perrin