webg has asked for the wisdom of the Perl Monks concerning the following question:
the way it is set right now, it doesn't work - it won't save the info to the database. however if you make the session handle local - it saves it to the database with a smile. thanks for any help, webg#!/usr/bin/perl $dbn = "DBI:mysql:***"; $dbu = "***"; $dbp = "***"; use CGI; use DBI; use CGI::Session; my $cgi = new CGI; $dbh = DBI->connect($dbn, $dbu, $dbp, {RaiseError=>1,AutoCommit=>1}) o +r die ($DBI::errstr); &initsession; &addanothervalue; print $cgi->header; print "$sessionid<p> $session<p><p>"; sub addanothervalue { # -> comment out this line (to get working) $session->param('test',1); } sub initsession { #$session = new CGI::Session("driver:file",undef,{Directory=>'temp +'}); # -> add my to this line below (to get working) $session = new CGI::Session("driver:MySQL",undef,{Handle=>$dbh}); $sessionid = $session->id; $session->expire('+1h'); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cgi::sessions can not create global session handle
by shenme (Priest) on Feb 12, 2005 at 10:06 UTC | |
by webg (Initiate) on Feb 12, 2005 at 16:27 UTC |