The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Prancer::Session::State::Cookie

SYNOPSIS

THis module enables a session state handler. NOTE: One should not use this module to connect to the database. Instead, one should use Prancer::Context.

This module implements a session state handler. It will keep track of sessions by setting cookies into the response headers and reading cookies in the request headers. You must enable this if you want sessions to work.

To use this session state handler, add this to your configuration file:

    session:
        state:
            driver: Prancer::Session::State::Cookie
            options:
                key: PSESSION
                path: /
                domain: .example.com
                # expires in 30 minutes
                expires: 1800
                secure: 1
                httponly: 1

OPTIONS

key

Set the name of the cookie. The default is PSESSION.

path

Path of the cookie, this defaults to "/";

domain

Domain of the cookie. If nothing is supplied then it will not be included in the cookie.

expires

Expiration time of the cookie in seconds. If nothing is supplied then it will not be included in the cookie, which means the session expires per browser session.

secure

Secure flag for the cookie. If nothing is supplied then it will not be included in the cookie. If this is set then the cookie will only be transmitted on secure connections.

httponly

HttpOnly flag for the cookie. If nothing is supplied then it will not be included in the cookie. If this is set then the cookie will only be accessible by the server and not by, say, JavaScript.