Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Interpolate within Template

by edoc (Chaplain)
on Jan 13, 2005 at 01:36 UTC ( [id://421837]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://421837]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-19 20:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found