The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catalyst::Plugin::Session::State::Cookie - Maintain session IDs using cookies.

SYNOPSIS

    use Catalyst qw/Session Session::State::Cookie Session::Store::Foo/;

DESCRIPTION

In order for Catalyst::Plugin::Session to work the session ID needs to be stored on the client, and the session data needs to be stored on the server.

This plugin stores the session ID on the client using the cookie mechanism.

METHODS

Returns a hash reference with the default values for new cookies.

Sets the cookie based on cookie_name in the response object.

calc_expiry
delete_session_id
extend_session_id
get_session_id
set_session_id

EXTENDED METHODS

prepare_cookies

Will restore if an appropriate cookie is found.

finalize_cookies

Will set a cookie called session if it doesn't exist or if its value is not the current session id.

setup_session

Will set the cookie_name parameter to its default value if it isn't set.

CONFIGURATION

The name of the cookie to store (defaults to Catalyst::Utils::apprefix($c) . '_session').

The name of the domain to store in the cookie (defaults to current host)

Number of seconds from now you want to elapse before cookie will expire. Set to 0 to create a session cookie, ie one which will die when the user's browser is shut down.

If this attribute set true, the cookie will only be sent via HTTPS.

The path of the request url where cookie should be baked.

For example, you could stick this in MyApp.pm:

  __PACKAGE__->config( session => {
     cookie_domain  => '.mydomain.com',
  });

CAVEATS

Sessions have to be created before the first write to be saved. For example:

        sub action : Local {
                my ( $self, $c ) = @_;
                $c->res->write("foo");
                $c->session( ... );
                ...
        }

Will cause a session ID to not be set, because by the time a session is actually created the headers have already been sent to the client.

SEE ALSO

Catalyst, Catalyst::Plugin::Session.

AUTHORS

Yuval Kogman <nothingmuch@woobling.org>

CONTRIBUTORS

This module is derived from Catalyst::Plugin::Session::FastMmap code, and has been heavily modified since.

  Andrew Ford
  Andy Grundman
  Christian Hansen
  Marcus Ramberg
  Jonathan Rockway E<lt>jrockway@cpan.orgE<gt>
  Sebastian Riedel

COPYRIGHT

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.