Hi, I just ran through the code and I do not believe there is a way to do this. 
I think you will need to subclass Provider.pm, and redefine the _fetch routine. 
You can probably just copy it over into your subclassed module, and then make 
the modifications you need.

There are a few examples how you can subclass Provider.pm on the web:
http://template-toolkit.org/pipermail/templates/2001-June/001037.html
http://66.102.7.104/search?q=cache:vBQNoGAjDa0J:www.grahamnet.org.uk/test/slash/Slash/Display/Provider/Provider.pm+%22use+base+qw(Template::Provider)%3B%22&hl=en
http://www.mail-archive.com/[email protected]/msg05852.html


Here tells you how to use your subclassed Provider.pm I think.
http://www.template-toolkit.org/docs/plain/Manual/Config.html
I believe it is the LOAD_TEMPLATES config option, although I could be entirely 
wrong as I have not done this myself before.

Hopefully that helps you out. If anyone thinks what I've proposed is wrong, 
feel free to yell. :) This is all based on a quick run-thru of the code.

-- Josh

Fagyal Csongor wrote:
Hi folks,

I would like to kind of pre-process the templates I pass to TT. However, I want to keep all the nice caching features (disk+memory), so what I would like to do is to first filter the file TT is processing through a sub I wrote, but *only* when the file is changed on disk (which TT knows and handles anyway). So I need something like:

sub process {
   # ....
   # do lots of magic
   # ...
   # if (template_changed_on_disk) $text = slurp ....
   # ...

   &my_filter_hack(\$text);   # doing some multilingual preporcessing

   # ...
   # continue magic
   # ...
}

Is there an easy way to do what's above? Preferably without subclassing / rewriting Template.pm :)

Thanks,
- Fagzal


_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to