<?xml version="1.0" encoding="windows-1252"?>
<node id="969609" title="Re: DBIx::Class Result classes using Moose" created="2012-05-09 08:39:08" updated="2012-05-09 08:39:08">
<type id="11">
note</type>
<author id="645661">
tospo</author>
<data>
<field name="doctext">
&lt;h1&gt;Using Moose Roles in ResultSet Classes&lt;/h1&gt;
turns out that this is a bit more tricky and needs some more magic.
Thanks to the folks over on irc I found out that you need to fiddle with the BUILDARGS to make it work.
So, the above code works for &lt;b&gt;Result&lt;/b&gt; classes, while the following will enable Moose in your &lt;b&gt;ResultSet&lt;/b&gt; classes:

&lt;code&gt;
package MyApp::Schema::ResultSet::Foo;

use strict;
use warnings;

use Moose;
use MooseX::NonMoose;
use MooseX::MarkAsMethods autoclean =&gt; 1;
 
extends 'DBIx::Class::ResultSet';

with 'SomeOldRole'; # insert your Role here...

# This is the crucial bit - don't ask....
sub BUILDARGS { $_[2] }

### your ResultSet methods here ###

__PACKAGE__-&gt;meta-&gt;make_immutable;
1;
&lt;/code&gt;</field>
<field name="root_node">
968402</field>
<field name="parent_node">
968402</field>
</data>
</node>
