[ABE.pm] Text::Template Q

Faber J. Fedor faber at linuxnj.com
Mon Jul 31 11:13:47 PDT 2006


On 31/07/06 12:58 -0400, Ricardo SIGNES wrote:
> * "Faber J. Fedor" <faber at linuxnj.com> [2006-07-31T12:37:47]
> > What I'm seeing is all of the above on STDOUT and two blanks lines in
> > test.out.
> 
> That's because...
> 
> > {
> >   print "Date is $date\n"  ; 
> >   my $i;
> >   for ($i = 0; $i<= 10; $i++) {print "$i\n"};
> > } 
> 
> You do not print in a Text::Template!  In the documentation, you will find
> this:

That explains half of the problems; the other half I've got working via
syntax changes.

> If you want to build up output, you use $OUT and append to it.
> 
> 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?

> I wonder how you ever had it working, using print...

At first, my $report_destination was \*STDOUT and I was redirecting
that to a file.  It's understandable why that worked.  I changed
$report_destination to a glob style file handle and that didn't work.
You suggested a new style fh and that did work.  That's why I moved it
into production.  The first time it ran in production, it failed.

I guess I have to go rewrite all of my templates now...


-- 
 
Regards,
 
Faber Fedor
President
Linux New Jersey, Inc.
908-320-0357
800-706-0701

http://www.linuxnj.com





More information about the ABE-pm mailing list