[Cgi-session-user] strange behavior with CGI::Application::Plugin::Session and SQLite
Brought to you by:
sherzodr
From: Mr. P. K. <pu...@ei...> - 2008-02-02 02:57:57
|
Greetings, I am doing my work on my Macbook with Perl 5.88 and CGI::Session 4.2 and the latest CGI::Application::Plugin::Session with DBD::SQLite 1.14 Here is what I see in my sessions table ***************** sqlite> .s CREATE TABLE sessions ( id CHAR(32) NOT NULL PRIMARY KEY, a_session TEXT NOT NULL ); sqlite> select * from sessions; 4510a1b1c1db6aec8e23d8ee6d6a1938|1234 912574e844d18f4ca5d8dcba4f8a7fd1|1234 ***************** Here is a bit of code ***************** # Connect to DBI database, with the same args as DBI->connect(); $self->dbh_config( "dbi:SQLite:dbname=$db", "", "", { RaiseError => 1, AutoCommit => 1 } ); my $dbh = $self->dbh; $dbh->{unicode} = 1; # Configure the session $self->session_config( CGI_SESSION_OPTIONS => [ "driver:sqlite;serializer:Storable", $self->query, {Handle => $dbh} ], DEFAULT_EXPIRY => "+1w", COOKIE_PARAMS => { -expires => "+24h", -path => "/", }, SEND_COOKIE => 1, ); and then, further down... $self->session->param("~user_id", $aref_nodes); ***************** and here is an error message from the Apache error_log ***************** [Fri Feb 01 19:39:32 2008] [error] [client 127.0.0.1] DBD::SQLite::db prepare warning: attempt to prepare on inactive database handle(0) at dbdimp.c line 249 at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/ Driver/sqlite.pm line 34., referer: http://localhost/~punkish/ckb/index.cgi ***************** Of course, line 34 in the above file is ***************** 32: my $dbh = $self->{Handle}; 33: 34: my $sth = $dbh->prepare("SELECT id FROM " . $self->table_name . " WHERE id=?"); 35: unless ( defined $sth ) { 36: return $self->set_error( "store(): \$sth->prepare failed with message " . $dbh->errstr ); 37: } ***************** So, am I correct in deciphering that the Storable serializer is not serializing and storing data in the table properly, or perhaps, it is not even reaching that far because the $dbh is breaking in transit somehow? Any suggestions/guidance will be appreciated. Many thanks, Puneet. |