[Dancer-users] Controlling Session expire time

Brian E. Lozier brian at massassi.com
Tue Mar 15 00:34:06 CET 2011


Hmm, I dug into the actual code and found this in Dancer::Session::Abstract:

    if (my $expires = setting('session_expires')) {
        $cookie{expires} =
          Dancer::Cookie::_epoch_to_gmtstring(time + $expires);
    }

It appears I can have a global timeout option in the settings.  This
is useful although I think I need something a bit more flexible.  I
need to be able to choose a session time out based on user input.  For
example, if they check "remember me" I want the session to expire in 2
weeks, otherwise just use a session cookie.

The write_session_id method is specifically mentioned as something I
should not attempt to overload.  Does anyone have any ideas about how
I can have a dynamic session timeout?

Thanks again,
Brian


On Mon, Mar 14, 2011 at 4:27 PM, Brian E. Lozier <brian at massassi.com> wrote:
> When I use Dancer::Session::YAML to create a session, the session
> cookie is set to expire when the browser closes.  Is there a way for
> me to set an expire time for the session cookie?  I looked in
> Dancer::Session, Dancer::Session::YAML, Dancer::Cookbook, and
> Dancer::Session::Abstract but didn't see anything (maybe I missed it).
>
> Thanks,
> Brian
>


More information about the Dancer-users mailing list