in reply to Re: CGI::Session session expiration problems
in thread CGI::Session session expiration problems

$s = new CGI::Session("driver:file", undef, {Directory=>'/tmp'}); $s->expire('+15m');


What I want is to expire the session if no activity. What I get is: session expires after 15m even if there is activity.

It expires when atime() - ctime() eq expire() even if the user is alive.

Any clues?

Replies are listed 'Best First'.
Re^3: CGI::Session session expiration problems
by Corion (Patriarch) on Jan 16, 2009 at 08:52 UTC

    I don't see anything in the documentation that suggests this behaviour. So, maybe print out the three times and debug from there. The ctime of a file cannot be changed (without erasing and recreating the file), at least on unixish filesystems. But maybe CGI::Session never sees your changing atime.

      print1 of $s->atime(): 1232096086 print1 of $s->ctime(): 1232096013 print1 of $s->expire(): 900 print2 of $s->atime(): 1232096188 print2 of $s->ctime(): 1232096013 print2 of $s->expire(): 900

        Are you sure that passing a number to ->expire() is the right way to specify a relative offset? From reading the documentation, I would try to use '+15m' or maybe '+900'. I think giving it a plain number means you give it the epoch time, which in your case would expire all sessions after 1970-01-01 00:14:59.