[Catalyst] TT2 list context and DBIx::Class resultsets: solved?

Ash Berlin ash at cpan.org
Thu Jun 22 18:21:38 CEST 2006


Mark Blythe wrote:
> Hey, Template::Stash::Context is an interesting find.  That would 
> certainly solve the problem, even for situations other than DBIC 
> result sets.  The pod does state that it "adds a little overhead to 
> each stash call" and that the TT author is "a little wary of applying 
> that to the core default stash without investigating the effects first."
>
> It would make for an interesting profiling experiment.
>
>
> On 6/22/06, *Matt S Trout* <dbix-class at trout.me.uk 
> <mailto:dbix-class at trout.me.uk>> wrote:
>
>     Michele Beltrame wrote:
>     > Hello!
>     >
>     > While investigating the (usual) problem that I always get arrays
>     instead
>     > of ResultSet objects when exploring DBIx::Class related tables
>     in TT2, I
>     > came across the Template::Stash::Context module, which is
>     bundled in TT.
>     > By using a view defined this way:
>     >
>     > [% my_rs = album.songs.scalar %]
>
>     As of DBIC 0.07 you'll be able to do [% my_rs = album.songs_rs %]
>
>     --
>           Matt S Trout       Offering custom development, consultancy
>     and support
>        Technical Director    contracts for Catalyst, DBIx::Class and
>     BAST. Contact
>     Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk
>     <http://shadowcatsystems.co.uk> for more information
>
>     + Help us build a better perl ORM:
>     http://dbix-class.shadowcatsystems.co.uk/
>     <http://dbix-class.shadowcatsystems.co.uk/> +
>
>
The solution i came up with was to write an iterator plugin:

https://dev.firemirror.com:8080/svn/YourPreferences/trunk/YourPreferences/lib/DBIx/Class/TTPlugin/RSIter.pm

Ash





More information about the Catalyst mailing list