http://qs321.pair.com?node_id=661327


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 +esultSet.pm:1625-1630 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 (Patriarch) 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 { ... }