On Sat, Jan 08, 2005 at 02:44:23PM -0500, Perrin Harkins wrote:
> If you're setting variables all over the place, and you don't know them
> well enough to be sure there are no collisions, use INCLUDE.  I don't
> set variables in my templates, so I use PROCESS.

How can you avoid setting variables?


my $t = Template->new;
my $v = {
    nums => [ qw( one two three) ],
};
$t->process(\*DATA, $v) || die $t->error;

__DATA__

    [% item = "my item" %]

    # do something that has nothing to do with "item"
    [% PROCESS show_list list = nums %]

    Item is now [% item %] # "three"

    [% # some place else %]

    [% BLOCK show_list %]
        [%
            FOREACH item = list;
                "Item = [$item]\n";
            END;
        %]
    [% END %]


-- 
Bill Moseley
[EMAIL PROTECTED]


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

Reply via email to