in reply to CGI::Session session expiration problems

From looking at the documentation, I see:

So, expire() seems to look at atime(), at least when in "auto-expire" mode. I don't know what that is, but seeing that you've hidden your relevant code quite well, I guess that you're not using "auto-expire" mode or that your description of what you see does not correlate with what happens.

Why would you expect ctime() ever to change for one session?

Replies are listed 'Best First'.
Re^2: CGI::Session session expiration problems
by speckled (Novice) on Jan 16, 2009 at 08:29 UTC
    $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?

      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