[Catalyst] List/Scalar Context with TT + DBIC

Richard Jolly Richard.Jolly at bbc.co.uk
Thu Jun 1 17:12:42 CEST 2006


catalyst-bounces at lists.rawmode.org wrote:
> 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: 

[snip]

You can find a discussion of this problem on the DBIC mailing list:
 
 http://www.mail-archive.com/dbix-class@lists.rawmode.org/msg00291.html

At the moment In TT templates I'm just careful. If there is a big list,
where the iteration seems important, I set up the resultsets in the
controller code, where you can control context properly.

 $c->stash->{rs} = $rs; 
...
  [% WHILE (record = rs.next ) %]
...

Richard



http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.





More information about the Catalyst mailing list