CPAN::Forum
CGI-Session - is_expired never appears true
| Posted on Wed Dec 13 03:02:57 2006 by robertb |
| is_expired never appears true |
|
I am (I think) using the tutorial scenario:
$SESSION_DIR = "/data/mounts/test/session" ;
CGI::Session->name("APPSID");
...
$session = CGI::Session->load(undef, $SESSSID, {Directory=>"$SESSION_DIR"}) or die CGI::Session->er
+rstr;
if ( $session->is_expired ) {
print STDERR "E X P I R E D - session expired.\n" ;
}
if ( $session->is_empty ) {
print STDERR "Session file is EMPTY\n" ;
$session = $session->new(undef, $SESSSID, {Directory=>"$SESSION_DIR"});
# Store User ID (U) and passwd (P) in new session
$session->param('_timeout', "FOR IDLE TIME CHECKING");
$session->expires($SESSION_AGE) ;
$session->expires('_timeout',$USER_IDLE) ;
....
}
However I never execute the print statement "E X P I R E D ...".
It appears that the cookie created has the same expiry time as the session.
Am I right in thinking that since the cookie will always expire at the same time as the session, that ->load() will never be given the ID of an expired session since the cookie has 'gone' by then so it always apears empty.
I guess if I were to pass the session ID round some other way, then I would find expired sessions. Can anyone reassure me that I have interpreted the situation correctly. Or am I not seeing expired sessions for some other reason. If I am right, I think it might be useful to others to have this (I assume common) scenario documented in the tutorial. Thanks Robert |
| Write a response |
(3)
]