1 package Plack::Session::State;
5 use Plack::Util::Accessor qw[
11 my ($class, %params) = @_;
13 $params{'_expired'} ||= +{};
14 $params{'session_key'} ||= 'plack_session';
15 $params{'sid_generator'} ||= sub {
17 Digest::SHA1::sha1_hex(rand() . $$ . {} . time)
20 bless { %params } => $class;
23 sub expire_session_id {
25 $self->{'_expired'}->{ $id }++;
30 return unless $id && not exists $self->{'_expired'}->{ $id };
35 my ($self, $request) = @_;
36 $self->extract( $request )
38 $self->generate( $request )
42 my ($self, $request) = @_;
43 $self->check_expired( $request->param( $self->session_key ) );
48 $self->sid_generator->( @_ );
53 my ($self, $id, $response) = @_;
65 Plack::Session::State - Basic parameter-based session state
73 =item B<new ( %params )>
77 =item B<sid_generator>
83 =item B<get_session_id ( $request )>
85 =item B<extract ( $request )>
87 =item B<generate ( $request )>
89 =item B<finalize ( $session_id, $response )>
95 =item B<expire_session_id ( $id )>
97 =item B<check_expired ( $id )>
103 All complex software has bugs lurking in it, and this module is no
104 exception. If you find a bug please either email me, or add the bug
109 Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
111 =head1 COPYRIGHT AND LICENSE
113 Copyright 2009 Infinity Interactive, Inc.
115 L<http://www.iinteractive.com>
117 This library is free software; you can redistribute it and/or modify
118 it under the same terms as Perl itself.