[Catalyst] Perplexed Catalyst newbie
Sean McAfee
eefacm at gmail.com
Mon Apr 20 16:49:51 GMT 2009
On Mon, Apr 20, 2009 at 6:29 AM, Matt S Trout <dbix-class at trout.me.uk>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 =3D [ $b->cs ];
>
> not
>
> my $val =3D $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 =3D $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 =3D [ $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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090420/a53b6=
bcf/attachment.htm
More information about the Catalyst
mailing list