http://template-toolkit.org/docs/manual/Plugins.html#section_Scalar [% USE scalar %] [% row.scalar.objects.count %]
But as DBIx::Class provides you with scalar-only _rs methods for everything I use those instead. -- Best regards, Alex On Thu, 2010-12-23 at 18:04 +0100, Sam Kaufman wrote: > You *could* do [% row.objects_rs.count %] to force resultset context. > However, the fact that it's such a pain in the ass should tell you > that you're doing something in the view that shouldn't be done there. > Just stash the count from the controller, and you won't have to worry > about scalar context ;) > > On Thu, Dec 23, 2010 at 11:44 AM, Moritz Onken > <on...@houseofdesign.de> wrote: > Use Template::Alloy and do > > [% $(row.objects).count %] > > Am 23.12.2010 um 16:53 schrieb Alex Povolotsky: > > > > Hello! > > > > I'm writing an application that needs to count some related > objects > > > > [% row.objects.count %] results in "select * from objects" > > [% row.objects.scalar.count %] yields an error > > [% row.search_related_rs('objects').count %] is UGLY > > > > Do I have any better solution? > > > > Alex. > > > > > > _______________________________________________ > > List: Catalyst@lists.scsys.co.uk > > Listinfo: > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > > Searchable archive: > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > > Dev site: http://dev.catalyst.perl.org/ > > > _______________________________________________ > List: Catalyst@lists.scsys.co.uk > Listinfo: > http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ > > *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien Handelsgericht Wien, FN 79340b *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* Notice: This e-mail contains information that is confidential and may be privileged. If you are not the intended recipient, please notify the sender and then delete this e-mail immediately. *"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"* _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/