Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

$dbh->{CachedKids}

3 views
Skip to first unread message

David E . Wheeler

unread,
May 2, 2008, 4:23:33 PM5/2/08
to DBI Dev
Howdy,

I started getting test failures for Exception::Class::DBI on Perl 5.6
recently. The failures seem to be due to this test:

# For some reason, under perl < 5.8.0, $dbh->{Kids} returns a
different value
# inside the HandleError scope than it does outside that scope. So we're
# checking for the perl version here to cover our butts on this test.
This may
# be fixed in the DBI soon.
is( $err->kids, ($] < 5.008 ? 1 : 0), "Check kids" );

Was this fixed in the DBI? If so, in what version (I saw a change to
CachedKids in 1.55 that looked close, but that's not the same as
{kids}, is it?)?

Thanks,

david

Tim Bunce

unread,
May 2, 2008, 6:24:39 PM5/2/08
to David E. Wheeler, DBI Dev
You've not given me much to go on, but I'd guess it's related to the
timing of when perl invokes the DESTROY method (which has changed
between perl versions). In which case it may be mostly beyond the
control of the DBI.

A small self-contained example that behaves differently between
different DBI/Perl versions will buy you more of my time :)

Tim.

David E. Wheeler

unread,
May 2, 2008, 10:03:10 PM5/2/08
to Tim Bunce, DBI Dev
On May 2, 2008, at 15:24, Tim Bunce wrote:

> You've not given me much to go on, but I'd guess it's related to the
> timing of when perl invokes the DESTROY method (which has changed
> between perl versions). In which case it may be mostly beyond the
> control of the DBI.
>
> A small self-contained example that behaves differently between
> different DBI/Perl versions will buy you more of my time :)

Sorry Tim, I was hoping that that would be enough to shake some
neurons loose for an easy answer. Here is my original query about this
issue:

http://aspn.activestate.com/ASPN/Mail/Message/perl-DBI-Dev/1359462

And here is your relevant reply:

http://aspn.activestate.com/ASPN/Mail/Message/perl-DBI-dev/1449508

Only now I'm seeing that test fail on 5.6.2. Is it possible that 5.6.2
destroys the handle by the type the do() is called? I don't see your
comment in 07kids.t anymore.

Thanks,

David

Tim Bunce

unread,
May 9, 2008, 7:42:20 AM5/9/08
to David E. Wheeler, Tim Bunce, DBI Dev

Seems likely.

> I don't see your comment in 07kids.t anymore.

Got removed in May 2004
http://svn.perl.org/viewvc/modules/dbi/trunk/t/07kids.t?r1=333&r2=335

If you really need to capture the complete state at the time the error
*is recorded* rather than the time its *checked for and thrown* then
you could use HandleSetErr instead of HandleError:

http://search.cpan.org/~timb/DBI-1.604/DBI.pm#HandleSetErr_(code_ref,_inherited)

Tim.

David E. Wheeler

unread,
May 9, 2008, 12:22:19 PM5/9/08
to Tim Bunce, DBI Dev
On May 9, 2008, at 04:42, Tim Bunce wrote:

>> Only now I'm seeing that test fail on 5.6.2. Is it possible that
>> 5.6.2
>> destroys the handle by the type the do() is called?
>
> Seems likely.

Yes, I've released a new version where the test checks for $] > 5.6.1
instead of > 5.8.0.

Hrm. I guess it wasn't telling us much, since it's dependent on Perl
versions, rather than the implementation of the DBI.

> If you really need to capture the complete state at the time the error
> *is recorded* rather than the time its *checked for and thrown* then
> you could use HandleSetErr instead of HandleError:
>
> http://search.cpan.org/~timb/DBI-1.604/DBI.pm#HandleSetErr_(code_ref,_inherited)

Interesting, I hadn't seen that. As for my uses, I just wanted to get
my tests passing again. No one has complained about the state of the
error information in Exception::Class::DBI, to my knowledge. So I
think I'll leave it as-is.

Best,

David

0 new messages