in reply to Template Toolkit and Config Options

You can't really do that, although in theory, you could create different Template::Parser objects that have different settings for INTERPOLATE, and compile different Template::Document objects for your Template::Provider objects to return. But that still wouldn't switch it on and off on a per-invocation basis.

What problem are you actually trying to solve? Maybe there's another way if you back up a step and tell us. Also, check the very helpful Template Toolkit mailing list (described at http://www.tt2.org).

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Template Toolkit and Config Options

Replies are listed 'Best First'.
Re: •Re: Template Toolkit and Config Options
by petesmiley (Friar) on Apr 30, 2004 at 15:53 UTC
    Well... It is not a problem per se. In my case, I will just leave INTERPOLATE off for everything. I am processing some rather meaty looking apache config files. Some parts for easy editing, others not. Having INTERPOLATE was a matter of convenience.

    I thought leaving INTERPOLATE on would be fine at first except for an occasional spurious mixing of regexes for redirects and such. So, when I run the templates I'll get errors for things like having a $2 mixed into the template text. I would just escape this out by doing something like [%'$2'%] but this would make it more confusing for the template maintainers than just leaving INTERPOLATE off.

    I don't really have time for anything more complex than this. I did notice that the template tags could be changed for individual BLOCKS by using the TAGS directive in the template. Being a curious fellow, I figured I'd see if there was anything similar for INTERPOLATE that I had missed.

    I suppose there isn't though.

    smiles