X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FPlack%2FSession%2FState%2FCookie.pm;h=85c590890ae6212dc5cf48921ef13fdf80ab0c2f;hb=9dcca820988aab7409efc79baf34bb5d8f05bc63;hp=6bd11c3aae7e36208eb7c3fed34c8a91e6b3cf87;hpb=05b5f99d2078fb14c9338621b182cfb5d7858678;p=catagits%2FWeb-Session.git diff --git a/lib/Plack/Session/State/Cookie.pm b/lib/Plack/Session/State/Cookie.pm index 6bd11c3..85c5908 100644 --- a/lib/Plack/Session/State/Cookie.pm +++ b/lib/Plack/Session/State/Cookie.pm @@ -2,6 +2,9 @@ package Plack::Session::State::Cookie; use strict; use warnings; +our $VERSION = '0.02'; +our $AUTHORITY = 'cpan:STEVAN'; + use parent 'Plack::Session::State'; use Plack::Util::Accessor qw[ @@ -17,9 +20,9 @@ sub expire_session_id { $self->expires( 0 ); } -sub extract { +sub get_session_id_from_request { my ($self, $request) = @_; - $self->check_expired( ( $request->cookie( $self->session_key ) || return )->value ); + ( $request->cookie( $self->session_key ) || return )->value; } sub finalize { @@ -51,35 +54,54 @@ __END__ Plack::Session::State::Cookie - Basic cookie-based session state +=head1 SYNOPSIS + + use Plack::Builder; + use Plack::Middleware::Session; + + my $app = sub { + return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ]; + }; + + builder { + enable 'Session'; # Cookie is the default state + $app; + }; + =head1 DESCRIPTION +This is a subclass of L and implements it's +full interface. This is the default state used in +L. + =head1 METHODS =over 4 =item B -=item B - -=item B - -=item B +The C<%params> can include I, I, I and +I options, as well as all the options accepted by +L. -=item B +=item B -=back +Path of the cookie, this defaults to "/"; -=over 4 +=item B -=item B +Domain of the cookie, if nothing is supplied then it will not +be included in the cookie. -=item B +=item B -=back +Expiration time of the cookie, if nothing is supplied then it will +not be included in the cookie. -=over 4 +=item B -=item B +Secure flag for the cookie, if nothing is supplied then it will not +be included in the cookie. =back