[Dbix-class] Class::DBI vs DBIx and CDBICompat

Steven Mackenzie dbix at aptile.co.uk
Mon Jun 26 18:19:47 CEST 2006

Matt S Trout wrote:

>Steven Mackenzie wrote:
>>I stumbled upon this piece of documentation:
>>Which suggests that I can start using DBIx::Class simply my making this
>>change to my Class::DBI code:
>># In DBBase.pm
>>#use base qw( Class::DBI ); # currently using 3.0.6 from ActiveState ppm.
>>use base qw/DBIx::Class/; # currently 0.6000 from ActiveState pmm__PACKAGE__->load_components( qw/CDBICompat Core DB/ );
>>However, I get this error at startup:
>>Can't locate object method "set_db" via package "DBBase" at
>>C:\xyz\InitDatabase.pm line 33.
>>In my application I make the call to the Class::DBI method set_db via my
>>DBBase.pm module, like this:
>>  DBBase->set_db
>>  (
>>    'Main',
>>    $dsn, # passed in by caller
>>    $username,
>>    $password,
>>    {RaiseError => 1,
>>     AutoCommit => 0, # Don't autocommit transactions
>>     unicode => 1}
>>  );
>>How can I set the DBIx::Class DB connection?
>Why can't you just call ->connection ?
Because I thought that the Compat API was complete, and I don't know the
DBIx::Class API.

I've tried replacing the DBBase->set_db() call with  a call to
DBBase->connection(), but then I get this error the first time I try to
use one of my CDBI classes:
Can't call method "storage" on an undefined value at
C:/Perl/site/lib/DBIx/Class/ResultSource.pm line 411.

Has this every come up before? I didn't find anything in the mailing
list archive ...


More information about the Dbix-class mailing list