Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Template Toolkit and Config Options

by petesmiley (Friar)
on Apr 29, 2004 at 20:56 UTC ( [id://349272]=perlquestion: print w/replies, xml ) Need Help??

petesmiley has asked for the wisdom of the Perl Monks concerning the following question:

Hey all,

I have a problem I'm kind of stuck on. I'm using Template Toolkit to process some config files and I'm trying to figure out how to turn interpolation on or off for different blocks.

Is there a way to do this? There's only about 100 pages of docs for Template Toolkit, and I haven't had much luck figuring this one out.


Edit: To clear up any questions.

When I'm talking about blocks I'm talking about template blocks. Things that start with

[% BLOCK blockname %]
in the template.

When I talk about interpolation, I'm talking about the INTERPOLATE => 1 option whenever I create the template object.

I want it off when I do a

[% PROCESS blockname %]
for some and on for others.

Is this even possible?

Replies are listed 'Best First'.
•Re: Template Toolkit and Config Options
by merlyn (Sage) on Apr 29, 2004 at 23:45 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.


Re: Template Toolkit and Config Options
by perrin (Chancellor) on Apr 29, 2004 at 21:56 UTC
    What do you mean? Are you talking about PERL blocks and the EVAL_PERL config option?

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://349272]
Approved by kvale
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-12 15:17 GMT
Find Nodes?
    Voting Booth?

    No recent polls found