On Monday, September 9, 2002, at 06:11 PM, Jeff Urlwin wrote:From perldoc DBI:
If the subroutine returns a false value then the "RaiseError" and/or
"PrintError" attributes are checked and acted upon as normal.
I read that as if the subroutine returns non-false values, then RaiseError
and PrintError will not be acted upon...
Okay, here's a new version of the patch that should take this into consideration:
--- Downloads/DBI-1.30/DBI.pm Thu Jul 18 07:24:04 2002
+++ DBI.pm Sun Nov 24 11:35:38 2002
@@ -503,9 +503,12 @@
unless ($dbh = $drh->$connect_meth($dsn, $user, $pass, $attr)) {
my $msg = "$class->connect($dsn) failed: ".$drh->errstr;
if (%attr) {
- # XXX add $attr{HandleError} logic here?
- Carp::croak($msg) if $attr->{RaiseError};
- Carp::carp ($msg) if $attr->{PrintError};
+ # XXX add $attr{HandleError} logic here? Yes!
+ unless ($attr->{HandleError} &&
+ !$attr->{HandleError}($msg, $drh, $dbh)) {
+ Carp::croak($msg) if $attr->{RaiseError};
+ Carp::carp ($msg) if $attr->{PrintError};
+ }
}
DBI->trace_msg(" $msg\n");
$! = 0; # for the daft people who do DBI->connect(...) || die "$!";
Regards,
David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/ Yahoo!: dew7e
Jabber: [EMAIL PROTECTED]
