Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: DBIx::Class Result classes using Moose

by tospo (Hermit)
on May 09, 2012 at 12:39 UTC ( [id://969609]=note: print w/replies, xml ) Need Help??


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;

Replies are listed 'Best First'.
Re^2: DBIx::Class Result classes using Moose
by mcsnolte (Initiate) on Aug 13, 2012 at 17:20 UTC

    When using MooseX::NonMoose in my ResultSet class as described here I find that calling new() on it fails when it tries to proxy over to new_result().

    Is this a known bug (or limitation) of MooseX::NonMoose? Or am I doing something wrong?

    Error I get (on DBIx-Class-0.08196):

    Can't call method "isa" on unblessed reference at DBIx::Class::ResultSet::new(/usr/local/share/perl/5.10.1/DB +Ix/Class/ResultSet.pm:197)
      sorry for the delay - haven't been in here for a while... Can't even help you much I'm afraid. It worked fine for me. Can you post some code?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://969609]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 22:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found