[Catalyst] connection() or die

Matt S Trout dbix-class at trout.me.uk
Sat Jan 14 08:03:30 CET 2006


On Fri, Jan 13, 2006 at 10:03:28PM -0800, apv wrote:
> I swear I tried to solve this and searched about 20 pages and query 
> combinations but I can't find it.
> 
> How do you verify your connection is good in a Model base class?
> 
> I know it's the problem when I'm getting "Can't call method "search" on 
> an undefined value at ..."
> but I would like to test for it in the module to do something with some 
> sane/directed feedback.

Hmm ... the problem is that you don't want to leave the connection around
in case you fork afterwards. Best bet is probably to try a plain DBI->connect
yourself to ensure the db connection's good and then discard that $dbh.

-- 
     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 Catalyst mailing list