http://www.perlmonks.org?node_id=969609


in reply to DBIx::Class Result classes using Moose

Using Moose Roles in ResultSet Classes

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 Result classes, while the following will enable Moose in your ResultSet classes:
package MyApp::Schema::ResultSet::Foo; use strict; use warnings; use Moose; use MooseX::NonMoose; use MooseX::MarkAsMethods autoclean => 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__->meta->make_immutable; 1;