lhp@nereida:~/Lperl/src/template_toolkit/src$ cat -n ex2.pl
1 #!/usr/local/bin/perl -w
2 use strict;
3 use Template;
4
5 my $tt = Template->new({
6 INCLUDE_PATH => '/home/lhp/Lperl/src/template_toolkit/src/tt'
7 });
8
9 my @perlprogs = map { { name => $_, size => -s $_} } glob('*.pl');
10
11 my %vars = (
12 files => \@perlprogs,
13 );
14 $tt->process('forex', \%vars);
lhp@nereida:~/Lperl/src/template_toolkit/src$ cat -n tt/forex
1 [% FOREACH file IN files -%]
2 [% file.name %] has size [% file.size %]
3 [% END %]
lhp@nereida:~/Lperl/src/template_toolkit/src$ ex2.pl ex1.pl has size 266 ex2.pl has size 288
Casiano Rodríguez León
