[Catalyst] List/Scalar Context with TT + DBIC

Mark Blythe list at markblythe.com
Wed May 31 18:47:08 CEST 2006


This isn't strictly a Catalyst question, but it involves the
interaction of two commonly used Catalyst components: TT + DBIC.  I'm
sure this must be an FAQ, but so far, RTFM and Googling have not
revealed the answer.

How can I force scalar context from TT in order to get a DBIC
ResultSet object back from search() rather than a list of rows?  For
instance:

In TT template:

[% results = c.model('DB::Foo').search({ col => $value }) %]

This turns "results" into a list of records rather than an object I
can call next(), first(), etc on.

I'll gladly RTFM if somebody can point me to the right FM.

Thanks.



More information about the Catalyst mailing list