[Dbix-class] CDBICompat

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Fri Nov 7 14:07:24 GMT 2008

I'm trying to use CDBICompat to convert a legacy application from
Class::DBI to DBIx::Class. My first step is to get the application to
run under DBIC, then I'll start to move parts of it to the new idiom.

But I'm stuck! My test program runs through all the CDBI initialization
code (i.e. a use statement for MyBaseClass) but when I try to use any
method in one of the table classes I get an error that seems to be due
to an undefined schema. For example, if I run:

  my $object = My::Artist->retrieve(1);

I see:

Uncaught exception from user code:
        Can't call method "default_resultset_attributes" on an undefined
value at trunk/blib/lib/DBIx/Class/ResultSource.pm line 1075.
 at trunk/blib/lib/DBIx/Class/ResultSource.pm line 1076

called at trunk/blib/lib/DBIx/Class/DB.pm line 144
        DBIx::Class::DB::resultset_instance('My::Artist') called at
trunk/blib/lib/DBIx/Class/CDBICompat/LazyLoading.pm line 9

called at trunk/blib/lib/DBIx/Class/ResultSetProxy.pm line 14
'HASH(0x8d83114)') called at
trunk/blib/lib/DBIx/Class/CDBICompat/Retrieve.pm line 27
        DBIx::Class::CDBICompat::Retrieve::retrieve('My::Artist', 1)
called at ./test.pl line 68

The offending line in DBIx/Class/ResultSource.pm is:


I've poked around a bit but can't see where schema is set up.

Does anybody recognize these symptoms? Or can suggest what to try next.

Thanks, Dave

More information about the DBIx-Class mailing list