bash has asked for the wisdom of the Perl Monks concerning the following question:
Hello Guru,
I got unexpected error using CGI::Session + DBD::SQLite.
This is my simple perl program:
But it returns warnings all the times:#!/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);
After little investigation I found that this problems goes from this code snippet: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/DBI.pm line 13 +3. closing dbh with active statement handles at /Library/Perl/5.8.8/CGI/S +ession/Driver/DBI.pm line 133.
If substitute prepare_cached with prepare my program executes without warnings. But maybe exist solution how to fix it without modification of CGI::Session?/Library/Perl/5.8.8/CGI/Session/Driver/DBI.pm: [...] 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; } [...]
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: CGI::Session + DBD::SQLite = closing dbh with active statement handles
by dsheroh (Monsignor) on Feb 02, 2008 at 18:45 UTC | |
by bash (Scribe) on Feb 02, 2008 at 23:12 UTC | |
by bash (Scribe) on Feb 05, 2008 at 05:06 UTC | |
Re: CGI::Session + DBD::SQLite = closing dbh with active statement handles
by bash (Scribe) on Feb 05, 2008 at 05:12 UTC | |
Re: CGI::Session + DBD::SQLite = closing dbh with active statement handles
by markjugg (Curate) on Feb 05, 2008 at 14:39 UTC | |
by bash (Scribe) on Feb 06, 2008 at 09:02 UTC |
Back to
Seekers of Perl Wisdom