Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello Guru, I got unexpected error using CGI::Session + DBD::SQLite. This is my simple perl program:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use CGI::Session; my $session = new CGI::Session( 'driver:sqlite;serializer:Storable', "91b85831787f534e3f9b6448da10af18", {DataSource => 'db/sessions.db'} ) or die (CGI::Session->errstr);
But it returns warnings all the times:
DBI::db=HASH(0x89601c)->disconnect invalidates 1 active statement hand +le (either destroy statement handles or call finish on them before di +sconnecting) at /Library/Perl/5.8.8/CGI/Session/Driver/ line 13 +3. closing dbh with active statement handles at /Library/Perl/5.8.8/CGI/S +ession/Driver/ line 133.
After little investigation I found that this problems goes from this code snippet:
/Library/Perl/5.8.8/CGI/Session/Driver/ [...] sub retrieve { my $self = shift; my ($sid) = @_; croak "retrieve(): usage error" unless $sid; my $dbh = $self->{Handle}; my $sth = $dbh->prepare_cached("SELECT a_session FROM " . $self->t +able_name . " WHERE id=?", undef, 3); unless ( $sth ) { return $self->set_error( "retrieve(): DBI->prepare failed with + error message " . $dbh->errstr ); } $sth->execute( $sid ) or return $self->set_error( "retrieve(): \$s +th->execute failed with error message " . $sth->errstr); my ($row) = $sth->fetchrow_array(); return 0 unless $row; return $row; } [...]
If substitute prepare_cached with prepare my program executes without warnings. But maybe exist solution how to fix it without modification of CGI::Session?

In reply to CGI::Session + DBD::SQLite = closing dbh with active statement handles by bash

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (5)
    As of 2018-01-21 17:09 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (228 votes). Check out past polls.