On Mon, Apr 20, 2009 at 6:29 AM, Matt S Trout <[email protected]>wrote:

> On Sun, Apr 19, 2009 at 09:51:42PM -0700, Sean McAfee wrote:
> > [% FOR a IN as; FOR b IN a.bs; b.cs; "<br>"; END; END %]
>
> b.cs here is equivalent to:
>
> my $val = [ $b->cs ];
>
> not
>
> my $val = $b->cs;
>

Where does that happen?  I'm pretty intimately familiar with the Template
Toolkit, having written the Python port, so I know that all method calls in
a template occur in scalar context, and so "b.cs" in a template should
indeed translate to "my $val = $b->cs;" on the Perl side.

There's talk of introducing a new operator in the next version of TT,
perhaps ".@", that would introduce list context to a method call, and do
something more like "my $val = [ $b->cs ];", but it's definitely not here
yet.


> You probably wanted b.cs_rs, which always returns a resultset.
>

So after some finagling, my template now reads:

[% FOR a IN as; FOR b IN a.bs_rs; !b.cs_rs.defined; "<br>"; END; END %]

And this is the output:

1
1

Still seemingly not the right thing.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to