punkish has asked for the wisdom of the Perl Monks concerning the following question:
causes the following error --#!/usr/bin/perl -w # Import the modules use strict; use CGI::Session; use CGI::Pretty qw(:standard); use HTML::Template; use DBI; # various config parameters my $host = 'localhost'; my $db = 'dem.sqlite'; my $dbtype = 'SQLite'; #my $table = 'sessions'; my $dbuname = ''; my $dbpwd = ''; my $login_limit = 3; # create a new database connection my $dbh = DBI->connect("dbi:$dbtype:$db", '', '', {PrintError => 1, Ra +iseError => 1}); # The session is initialized or recalled. The session allows checking +whether # the user is logged in or not. my $cgi = new CGI; my $session = new CGI::Session("driver:$dbtype", $cgi, {Handle => $dbh +}); my $cookie = $cgi->cookie(CGISESSID => $session->id);
Use of uninitialized value in join or string at
/Library/Perl/5.8.1/darwin-thread-multi-2level/DBI.pm line 529
during global destruction.
(in cleanup) Can't connect( HASH(0x80ca40)), no database
driver specified and DBI_DSN env var not set at
/Library/Perl/5.8.1/CGI/Session/SQLite.pm line 133
Line 133 in the relevant module is thusly
Needless to say, this darn thing was working in another incarnation. I have no idea where I have screwed it up, and now it croaks with the above error. As far as I can see, I am too passing it the Handle, so it shouldn't even bother trying to make another DBI connection.$self->{SQLite_dbh} = $args->{Handle} || DBI->connect( $args->{DataSource}, $args->{User} || undef, $args->{Password} || undef, { RaiseError=>1, PrintError=>1, AutoCommit=>1 } );
Googling produces many instances of similar error, but with all kinds of different reasons, mainly relating to some typo or permissions error in creating the handle. Funny thing is, my $dbh is just fine as I have tested it with test queries and it works well.
Any insights will be much appreciated even if they show me up in a silly light. Learning experiences are always a step in the right direction.
Gracias.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with CGI::Session / DBI connection
by antirice (Priest) on Mar 02, 2004 at 08:08 UTC | |
by punkish (Priest) on Mar 02, 2004 at 14:18 UTC | |
by jdtoronto (Prior) on Mar 02, 2004 at 15:47 UTC | |
by punkish (Priest) on Mar 02, 2004 at 18:23 UTC |