Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: Add a method to a ResultSet Class in DBIx::Class?

by matija (Priest)
on Jan 09, 2008 at 12:25 UTC ( #661327=note: print w/replies, xml ) Need Help??

in reply to Re: Add a method to a ResultSet Class in DBIx::Class?
in thread Add a method to a ResultSet Class in DBIx::Class?

Nope, that doesn't seem to be it:

my $articles = $schema->resultset('ThreadedDB::Article'); DB<3> x $articles->can('create') 0 CODE(0x88b1cd4) -> &DBIx::Class::ResultSet::create in /usr/share/perl5/DBIx/Class/R DB<4> x $articles->can('insert_article') 0 undef

Replies are listed 'Best First'.
Re^3: Add a method to a ResultSet Class in DBIx::Class?
by Corion (Pope) on Jan 09, 2008 at 12:29 UTC

    I forgot to say that in my first reply, sorry.

    If that namespace does not work, find out the real namespace of your resultset:

    warn ref ($schema->resultset('ThreadedDB::Article'));

    and then put your routines into that namespace, whatever it is.

      No, I should be sorry, because I forgot to say in my original submission that I did look at that:

      DB<5> x ref $schema->resultset('ThreadedDB::Article') 0 'DBIx::Class::ResultSet'

      I'm not comfortable adding my methods to that...

        This reminds me what I did, for a short time. In the end, I found my approach unworkable due to other reasons:

        ... $schema->source('ThreadedDB::Article')->resultset_class('ThreadedDB::A +rticle::ResultSet'); ... package ThreadedDB::Article::ResultSet; use parent 'DBIx::Class::ResultSet'; sub frobnitz { ... }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://661327]
[stevieb]: I am thankful that I fell into Perl years ago in the manner I did. I don't believe there is another language that people care about so much, that they're willing to give everything. Langs come and go, but in Perl, it seems, things remain consistent.
[stevieb]: The people back then (~2000) are the same people now, but with much more experience. I'm appreciative that I fell into the Perl rabbit hole.
[stevieb]: Coding circles around Python devs, showing how unit tests should be done, enabling easy access to everything, learning basic C to wrap for direct hardware access... I am thankful.
[stevieb]: I'm in an appreciative mood. Thank you fellow Monks, for all I know, and for the knowledge which I can pass on

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-02-25 01:22 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (364 votes). Check out past polls.