[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

DBIx::Class::ResultSource::resultset('DBIx::Class::ResultSource::Table=HASH(0x902844c)')
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

DBIx::Class::CDBICompat::LazyLoading::resultset_instance('My::Artist')
called at trunk/blib/lib/DBIx/Class/ResultSetProxy.pm line 14
        DBIx::Class::ResultSetProxy::find('My::Artist',
'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:

      %{$self->schema->default_resultset_attributes}


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