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

Matt S Trout dbix-class at trout.me.uk
Tue Jun 27 17:06:53 CEST 2006

Steven Mackenzie wrote:
> Matt S Trout wrote:
>> Steven Mackenzie wrote:
>>> Matt S Trout wrote:
>>> 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 ...
>> Without seeing more of your code I can't easily debug; my best guess would be 
>> you're calling that after the class tree's loaded rather than in the DBBase.pm 
>> file during use base.
> Yes, that's exactly what I do -- worked fine with CDBI :-(
> Unfortunately, my app constructs a new DSN at each run-time from user
> input. Is there a way that I can still use CDBICompat and set the
> connection information at run time?

Right. DBIC makes this easier for main usage by allowing schema objects 
(multiple connections per class tree :D).

Have a look at the docs for DBIx::Class::DB which describes the workaround 
required for this.

      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

More information about the Dbix-class mailing list