Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Perl Monk, Perl Meditation

DBD::AnyData and 'handle cleared whilst still active' warning

by iguanodon (Curate)
on Jun 19, 2007 at 14:48 UTC ( #622029=perlquestion: print w/ replies, xml ) Need Help??

I recently started using DBD::AnyData to query some flat files and it works great - except for the warnings it spits out. If I run the basic example from the DBD::AnyData docs, it prints the result set, followed by:
DBI st handle 0x9bd6468 cleared whilst still active. dbih_clearcom (sth 0x9bd6468, com 0x9bd83b8, imp DBD::AnyData::st) +: FLAGS 0x88005: COMSET Active HandleError PARENT DBI::db=HASH(0x9bd6384) KIDS 0 (0 Active) NUM_OF_FIELDS 2 NUM_OF_PARAMS 0
I did add $sth->finish and $dbh->disconnect to my test script but I still get that output.

I thought I could just add a __WARN__ handler to ignore this particular warning, but that only solves part of the problem. It appears that only the first line of the above output is the warning, the part starting with dbih_clearcom still gets printed.

I also tried using $dbh->{HandleError} but my handler isn't being called. Here's what I've tried so far:

#!/usr/bin/env perl use strict; use warnings; $| = 1; use DBI; $SIG{__WARN__} = \&handle_warnings; my $dbh = DBI->connect('dbi:AnyData:'); $dbh->{HandleError} = \&handle_errors; $dbh->{RaiseError} = 0; $dbh->{PrintError} = 0; $dbh->{PrintWarn} = 0; $dbh->{ShowErrorStatement} = 0; $dbh->{Warn} = 0; $dbh->func( 'cars', 'CSV', 'cars.csv', 'ad_catalog'); my $sth = $dbh->prepare('select make, model from cars'); $sth->execute(); while (my $row = $sth->fetch) { print "@$row\n"; } $sth->finish; $dbh->disconnect; sub handle_warnings { print Data::Dumper->Dump([\@_], ['*_']); my $warning = shift; print "Handling WARNING:\n$warning\n"; return if $warning =~ /handle .*? cleared whilst still active/ms; } sub handle_errors { print Data::Dumper->Dump([\@_], ['*_']); my $error = shift; print "Handling ERROR:$error\n"; 1; }
There is a bug report for this issue but it's been open for about a year. I've seen several recommendations here for DBD::AnyData, but no mention of this problem. Am I missing something obvious, or is there a workaround?

Comment on DBD::AnyData and 'handle cleared whilst still active' warning
Select or Download Code
Re: DBD::AnyData and 'handle cleared whilst still active' warning
by planetscape (Canon) on Jun 19, 2007 at 15:32 UTC
by jZed (Prior) on Jun 19, 2007 at 15:56 UTC
    Ok, you've shamed me into action. I just uploaded DBD-AnyData-0.09 to CPAN. If you can't wait for it to propagate, grab it from SVN. Sorry for the problems.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://622029]
Approved by planetscape
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2013-12-20 16:45 GMT
Find Nodes?
    Voting Booth?

    How do you parse XML?

    Results (430 votes), past polls