perleager has asked for the wisdom of the Perl Monks concerning the following question:
I have no clue what I'm doing wrong...and can only assume its something to do with the new 4.20 CGI::Session module.disconnect invalidates 1 active statement handle DBI::db=HASH(0x8320754)->disconnect invalidates 1 active statement han +dle (either destroy statement handles or call finish on them before d +isconnecting)
I did also add $sth->finish before calling disconnect, but it still gives me the same error. So its not the $sth handle...also I do know theres no need to call $sth->finish if DBI knows when the fetching suppose to stop. So my question is, whats causing this error? How can I further debug what handle is active and not being finished?use DBI; my $dbh = DBI->connect($location, $user, $ba_pass, { RaiseError => + 1, AutoCommit => 1}) or die "Couldn't connect to database: " . $DBI: +:errstr; eval { my $sth= $dbh->prepare("SELECT id FROM sessions"); my $id; $sth->execute; $sth->bind_columns(undef, \$id); my $f = 0; while ($sth->fetch) { $f++; if ($f == 1) { require CGI::Session; import CGI::Session; $CGI::Session::IP_MATCH = 0; } my $session = CGI::Session->load("driver:MySQL", + $id, {Handle=>$dbh}); if ($session->is_expired) { $session->delete(); $session->close(); } } $dbh->disconnect; }; if ($@) { print $@; $dbh->disconnect; }
|
|---|