----- Original Message -----
From: "David B. Bitton" <[EMAIL PROTECTED]>
> In case anyone would like to know how to implement alternating row colors
in
> a table using TT2, this is how:
TIMTOWTDI: Another lightweight way of doing this is to use a closure.
Then, TT is smart enough to execute the subref when you refer to it. You
can cut-n-paste this to test it.
use Template;
my $template = Template->new;
sub foo {
my @colors = @_;
sub { push @colors, shift @colors; return $colors[0] };
}
my $data = foo( '#FFFFFF', '#CCCCCC' );
$template->process(
\*DATA,
{
color => $data,
array => [qw/one two three four/]
}
) or die $template->error();
__DATA__
[%
FOREACH item = array;
item; " -> "; color; "\n";
END
%]
--
Cheers,
Curtis Poe
Senior Programmer
ONSITE! Technology, Inc.
www.onsitetech.com
503-233-1418
Taking e-Business and Internet Technology To The Extreme!