Posted on 2008-10-29 22:00:50-07 by joeborge
CGI::Session->load does not delete expired sessions from MySQL
I looked into Session.pm and MySQL.pm for details. For some reason, the following line (line# 83) in MySQL.pm doesn't seem to happen:
$dbh->do(qq|DELETE FROM $TABLE_NAME WHERE id=?|, undef, $sid);
load() returns an empty session but the expired sessions are still in MySQL's sessions table.
$session = CGI::Session->load("driver:MySQL", $cgi, {Handle=>$dbh}) or die CGI::Session->errstr();
I am using CGI::Session 4.36. Logout works with the following code:
if ($cgi->param('action') eq 'logout') { $session = CGI::Session->load("driver:MySQL", $cgi, {Handle=>$dbh}) or die CGI::Session->errstr; $session->delete(); $session->flush(); }
I emailed the author but did not get a repsponse. Did anyone have the same problem and get it resolved?
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.