[Dbix-class] role of result class?

Michele Beltrame mb at italpro.net
Wed Mar 15 11:18:13 CET 2006


Hello Matt!

> Custom resultset class.
> 
> package My::Schema::Foo;
> use base qw/DBIx::Class::Core/;
> ...
> __PACKAGE__->resultset_class('My::Schema::Foo::ResultSet');
>
> package My::Schema::Foo::ResultSet;
> use base qw/DBIx::Class::ResultSet/;

I tried this solution as follows:

----------------------------------------------------
package Aintra::M::Dbs::Schema::Calendar::ResultSet;
use base 'DBIx::Class::ResultSet';
use strict;
use warnings;

1;

[...]

package Aintra::M::Dbs::Schema::Calendar;
use base 'DBIx::Class';
use strict;
use warnings;

__PACKAGE__->load_components(qw/ Core /);
__PACKAGE__->resultset_class('Aintra::M::Dbs::Schema::Calendar::ResultSet');
----------------------------------------------------

I didn't define any methdos in the new result set for now, just let it
inherit the base class ones. However it doesn't seem to inherit
correctly as I get this error:

-----
Couldn't instantiate component "Aintra::M::Dbs", "Cannot load schema
class 'Aintra::M::Dbs::Schema': Can't locate object method
"result_source_instance" via package
"Aintra::M::Dbs::Schema::Calendar::ResultSet" at
/usr/lib/perl5/vendor_perl/5.8.7/DBIx/Class/Schema.pm line 70.
-----

It doesnt' seem to inherit result_source_instance.

Thanks in advance for any help,
Michele.

-- 
Michele Beltrame
http://www.varlogarthas.net/
ICQ# 76660101
Informativa privacy: http://www.italpro.net/em.html



More information about the Dbix-class mailing list