From: Andy Grundman Date: Wed, 28 Dec 2005 06:11:52 +0000 (+0000) Subject: Session::State::Cookie, fixed cookie_expires to support browser session cookies,... X-Git-Tag: v0.02~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Plugin-Session-State-Cookie.git;a=commitdiff_plain;h=7022ec4c0fd4943997c9c5621d3e1972d0c7c929;hp=00fa6d616f7d92c777970491971588bd791018e6 Session::State::Cookie, fixed cookie_expires to support browser session cookies, perltidy, XXX: needs __expires fix --- diff --git a/Changes b/Changes new file mode 100644 index 0000000..8c39de0 --- /dev/null +++ b/Changes @@ -0,0 +1,7 @@ +Revision history for Perl extension Catalyst::Plugin::Session::State::Cookie + +0.02 + - Fixed cookie_expires to support browser session cookies. + +0.01 2005-11-14 12:45:00 + - Initial release. diff --git a/lib/Catalyst/Plugin/Session/State/Cookie.pm b/lib/Catalyst/Plugin/Session/State/Cookie.pm index 01f9dce..23402db 100644 --- a/lib/Catalyst/Plugin/Session/State/Cookie.pm +++ b/lib/Catalyst/Plugin/Session/State/Cookie.pm @@ -12,7 +12,8 @@ sub setup_session { my $c = shift; $c->NEXT::setup_session(@_); - $c->config->{session}{cookie_name} ||= Catalyst::Utils::appprefix( $c ) . '_session'; + $c->config->{session}{cookie_name} + ||= Catalyst::Utils::appprefix($c) . '_session'; } sub finalize_cookies { @@ -41,11 +42,15 @@ sub make_session_cookie { }; if ( exists $cfg->{cookie_expires} ) { - if ( my $ttl = $cfg->{cookie_expires} ) { - $cookie->{expires} = time() + $ttl; - } # else { cookie is non-persistent } + if ( $cfg->{cookie_expires} > 0 ) { + $cookie->{expires} = time() + $cfg->{cookie_expires}; + } + else { + $cookie->{expires} = undef; + } } else { + # XXX: FIXME, Session dropped __expires $cookie->{expires} = $c->session->{__expires}; } @@ -134,6 +139,12 @@ The name of the cookie to store (defaults to C