in reply to Class::DBI count_where method

Make your count_where() method in the Class::DBI namespace. Put the following in Class/DBI/Extension.pm
package Class::DBI; sub count_where { } 1;

Of course, you should really provide this as a patch to Class::DBI ... (you did email this back to the author, right?)

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

I shouldn't have to say this, but any code, unless otherwise stated, is untested

Replies are listed 'Best First'.
Re: Re: Class::DBI count_where method
by dcvr69 (Beadle) on May 19, 2004 at 18:20 UTC

    Not yet. I wasn't sure how to go about the __PACKAGE__->set_sql part as a mixin. I knew how to get count_where mixed in, but not the set_sql call. I guess I could use caller (?) to determine who was 'use'ing my module, and run the set_sql in that namespace... I think. Or am I missing something more basic?

    Well, I got it all working as a mixin. Now I'm working on adding the other aggregate functions (min/max/etc). Then I'll see if I can get that working, and submit to cdbi list for comment.

Re: Re: Class::DBI count_where method
by salvadors (Pilgrim) on May 25, 2004 at 07:16 UTC
    You probably want to check out Class::DBI::Plugin::CountSearch on CPAN, which does this "properly" - i.e. it has the same syntax as search() rather than requiring raw SQL.

    Tony