[ABE.pm] Text::Template Q
Ricardo SIGNES
rjbs-perl-abe at lists.manxome.org
Mon Jul 31 12:24:01 PDT 2006
* "Faber J. Fedor" <faber at linuxnj.com> [2006-07-31T14:13:47]
> > Alternately, you just have blocks that return something. You almost
> > certainly want to use $OUT, though, in this case.
>
> So any loop I use (and I use ALOT of loops!) have to use $OUT, right?
You should really read the excellent Text::Template documentation. It provides
multiple examples. Like:
Here is a list of the things I have got for you since 1907:
{ my $blist = '';
foreach $i (@items) {
$blist .= qq{ * $i\n};
}
$blist;
}
That will do what you want, for creating data from a loop and outputting it.
That can also be done with $OUT.
You could also continue printing, but first "select" the handle to which you
want to output. I do not advise doing this, because you will almost certainly
bite yourself.
> I guess I have to go rewrite all of my templates now...
s/print /$OUT .=/g;
--
rjbs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060731/0a0a83c0/attachment.bin
More information about the ABE-pm
mailing list