They say Dan Horne, on or about 15.Nov.2006 20:44, whispered:
>> 2) (assuming the answer to 1) is here) - How do I get the error message if
>> dbh_config fails?
> 
> I don't think that you'll get a message. Plugin-DBH is lazy loading, so
> the database connection won't actually get created until you try to
> access it the first time. dbh_config just defines up the parameters for
> the handle when it is finally used. 
> 
> To get any error message you'll need to test the $self->dbh calls (per
> statement, using RaiseError for mutiple db calls in an eval, or perhaps
> using something like Exception::Class::DBI)

If I don't want lazy-loading should I just create my own DBH?  (I want to die as
soon as possible if the DB connection isn't working)

Or should I do something along the lines of:

$self->dbh_config($dsn,$user,$pass,{RaiseError => 1});
eval { $self->dbh(); }
if ($@) {
        _do_dead_db($@);
}

Cheers,
Chris
-- 
Christopher Beck  -  http://pacanukeha.wordpress.com
A small amount of power also corrupts absolutely. -- Anonymous
Power corrupts and PowerPoint corrupts absolutely -- Vint Cerf

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to