[Catalyst] Session cookie and permanent state

Fayland Lam fayland at gmail.com
Sun Sep 24 04:59:23 CEST 2006


Yuval Kogman wrote:
> On Sat, Sep 23, 2006 at 04:15:48 +0000, fayland wrote:
>> hey, we have one function in our login interface like "remember me?" 
>> guess it's very common.
> 
> You can use Catalyst::Plugin::Session::DynamicExpiry, it was written
> exactly for this purpose.
> 
> $c->session_expire_key is definitely not enough, since that is only
> to expire single keys before the whole session store.
> 
> OTOH, if you set dynamic expiry, which basically means that a
> session can have an expiry time different than the default, set to
> e.g. 5 years, that should be enough.
> 
> Also note that many browsers can't handle dates that bass the 32 bit
> boundry (sometime in 2037), so don't overdo it with the expiry.
> 
> 	5 * 365 * 24 * 60 * 60
> 
> Is plenty of time.

now I'm using it. but I find something wrong. (guess it it!)
Always return expires => undef in the
Catalyst::Plugin::Session::DynamicExpiry 0.02
the Catalyst::Plugin::Session::State::Cookie 0.06 sub
make_session_cookie call calculate_session_cookie_expires
but in Catalyst::Plugin::Session::DynamicExpiry 0.02, there is no
calculate_session_cookie_expires.
after I add the sub in DynamicExpiry. it works. :)
------------------------------------------------
sub calculate_session_cookie_expires {
    my $c = shift;

    if ( defined(my $ttl = $c->session_time_to_live) ) {
        $c->log->debug("Overridden time to live: $ttl") if $c->debug;
        return time() + $ttl;
    }

    return $c->NEXT::calculate_session_cookie_expires( @_ );
}

not sure it is a fix or not. but it works for me now. thanks for your
help. (sorry I'm weak at writing test case and very busy for this moment).

Best Regards,

> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/




More information about the Catalyst mailing list