Re: [Templates] foreach problem with a one row result
[prev]
[thread]
[next]
[Date index for 2004/07/20]
On Tue, 20 Jul 2004, Mike Whitaker wrote:
> Change it to return an arrayref, not an array?
Indeed, the problem looks like it's a problem mapping between a perl array
and TT's scalar and lists. Basically, when you return the array from your
subroutine that contains only TT can't tell if it's a one element list or
a single scalar.
Things to do:
Always return a single arrayref from your function. This way TT knows
that you mean a list
Alternativly:
Use the .list virtual method on the return value. I.e.
weightLossFeatures.list. This will force it to be treated as a list.
Mark.
--
#!/usr/bin/perl -T
use strict;
use warnings;
print q{Mark Fowler, mark@xxxxxxxxxxxxxx.xxx, http://twoshortplanks.com/};
_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates