Tim Bunce wrote:
>
> [...]
>
> Well spotted. I can replicate that with this change to the tests:
>
> --- t/08keeperr.t (revision 56)
> +++ t/08keeperr.t (working copy)
> @@ -88,7 +88,7 @@
> is($warn, 0);
> is("@handlewarn", "1 0 0");
>
> -$dbh->set_err("0", "(got warn)", "AA001");
> +$dbh->set_err(0, "(got warn)", "AA001");
Me too:
# Looks like you failed 6 tests of 62.
> This seems to fix it:
>
> --- DBI.xs (revision 64)
> +++ DBI.xs (working copy)
> @@ -488,7 +488,8 @@
> if (SvTRUE(err) /* new error: so assign */
> || !SvOK(h_err) /* no existing warn/info: so assign */
> /* new warn ("0" len 1) > info ("" len 0): so assign */
> - || (SvOK(err) && SvCUR(err) > SvCUR(h_err)) ) {
> + || (SvOK(err) && strlen(SvPV_nolen(err)) > strlen(SvPV_nolen(h_err)))
> + ) {
Looks good:
-> nullp_test for DBD::NullP::db (DBI::db=HASH(0x1849a20)~0x1847a54) thr#015EEFB0
1 -> set_err in DBD::_::common for DBD::NullP::db (DBI::db=HASH(0x1847a54)~INNER ''
'E1') thr#015EEFB0
*0 0
*2 0
*3 0
!! info: '' 'E1'
1 <- set_err= undef at NullP.pm line 54 via set_err.pl line 6
1 -> set_err for DBD::NullP::db (DBI::db=HASH(0x1847a54)~INNER 0 'E2') thr#015EEFB0
*0 25877424
*1 0
*2 1
*3 1
!! warn: 0 'E1
E2'
1 <- set_err= undef at NullP.pm line 55 via set_err.pl line 6
!! warn: 0 'E1
E2'
<- nullp_test= undef at set_err.pl line 6
DBD::NullP::db nullp_test warning: E1
E2 at set_err.pl line 6.
> Have you tried using the new set_err semantics for warnings DBD::ADO?
DBD::ADO currently uses the err=0 feature:
$DBD::ADO::err = 0 unless $DBD::ADO::errcum & 1 << 31; # oledberr.h
to suppress warnings (which works even with older DBI's).
I tested DBI 1.41 separately (not yet with DBD::ADO) and
don't expect any DBD::ADO specific problems.
BTW: Should warnings like
warn("Commit ineffective while AutoCommit is on")
warn('$h->rows count is incomplete before all rows fetched.')
Carp::carp("DSN component '$_' is not in 'name=value' format")
henceforth use set_err( 0, ...)? Or is there still a case for
plain warn/Carp::carp?
Steffen