[Dbix-class] db handle disconnect?

Matt S Trout dbix-class at trout.me.uk
Wed Aug 9 17:56:35 CEST 2006


Tim Keefer wrote:
> Anyone have some insight as to why I'm unable to successfully cache the 
> dbh?
> 
> When calling the connect method I pass it a code reference like so:
> 
> my $dbh = get_dbh();
> if ( ! $dbh ) {
>    $dbh = DBI->connect_cached ....
>     store_dbh( $dbh );
> }
> return $dbh;
> 
> This used to work with the older version of DBIx::Class.

Define "work". Define "doesn't work anymore".

Post more code - we have no idea what your get_dbh and store_dbh routines are 
doing.

Also, why do you need to do this rather than letting DBIC handle the $dbh for 
you? It's better at it than any code I've ever written to do it (I only wrote 
the very first version of the Storage code, Brandon and others have massively 
improved it since) ...



More information about the Dbix-class mailing list