[Dbix-class] Problem using DBIC in a Catalyst/mod_perl environment with multiple virtual hosts

Matt S Trout dbix-class at trout.me.uk
Thu Aug 24 13:30:57 CEST 2006


Andreas Dembach wrote:
> 1) I could not figure out how to get rid of the initial connect_info set 
> by the ->config() call that Cat::DBIC::Schema seems to need during 
> startup, which annoys a little since I do not have any configuration 
> information during Apache startup.

Just don't set it, IIRC

> 2) I have to cache the schema for each database source, otherwise the 
> schema/storage/whatever seems to just vanish after returning the newly 
> cloned schema which results in exceptions like "Can't call method 
> "source" on an undefined value" or "calling execute on disconnected handle".

That's not really a problem as such. If you let the object go out of scope it 
goes out of scope :) if you don't do that you'll end up reconnecting all the 
time which is pretty gross. The reason you get the exceptions is because a 
live resultset doesn't keep the $schema in scope, since the alternative would 
be a circular reference and hence a memory leak.

-- 
      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