in reply to Interpolate within Template

If I'm understanding the problem correctly, there is no problem.

Are you saying that you need INTERPOLATE => 1 to get [% INCLUDE "$screen" % ] to work?

This works ok for me:

use Template; my $TMPL = Template->new(); my $res; $TMPL->process( \*DATA, { screen => qw(screen1 screen2)[rand 2] }, \$res ); print "$res\n"; __END__ [% INCLUDE "$screen" %] [% BLOCK screen1 %] This is screen #1. [% END %] [% BLOCK screen2 %] This is screen #2. [% END %]

From the docs:

The INTERPOLATE flag, when set to any true value will cause variable references in plain text (i.e. not surrounded by START_TAG and END_TAG) to be recognised and interpolated accordingly.

and you don't need to do that. In fact you really don't want to do that..

cheers,

J

Replies are listed 'Best First'.
Re^2: Interpolate within Template
by saskaqueer (Friar) on Jan 13, 2005 at 05:06 UTC

    OMG, I feel stupid. Thank you ever so much.