Hi,

I want my dbic components to be able to extend the ResultSet by adding
base classes when they are loaded.

For example if I have the following packages defined:

package MyDBIC::ResultSet::Foo;
use base qw/DBIx::Class::ResultSet/;

sub foo { warn "foo\n" }
1;

package MyDBIC::ResultSet::Bar;
use base qw/DBIx::Class::ResultSet/;

sub bar { warn "bar\n" }
1;

package MyDBIC::Foo;
use base qw/DBIx::Class/;
# add MyDBIC::ResultSet::Foo to @ResultSetClass::ISA
1;

package MyDBIC::Bar;
use base qw/DBIx::Class/;
# add MyDBIC::ResultSet::Bar to @ResultSetClass::ISA
1;

And then I do this:

# Schema/User.pm
package Schema::User;
use base qw/DBIx::Class/;
__PACKAGE__->load_components(qw/ +MyDBIC::Foo +MyDBIC::Bar Core /);

1;

# user.pl
my $schema = Schema->connect;
$schema->resultset('User')->foo;
$schema->resultset('User')->bar;

How do I make it work? What I want to know is if there is an easy way
to Inject the resultsets in the current ResultSet class.

Thanks,
-- 
Jonas

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to