Coverage Summary

# File Coverage

blib/lib/Prancer/Session/State/Cookie.pm
Criterion | Covered | Total | %
--- | --- | --- | ---
statement | 12 | 15 | 80.0
branch | 0 | 2 | 0.0
condition |  |  | n/a
subroutine | 4 | 5 | 80.0
pod | 1 | 1 | 100.0
total | 17 | 23 | 73.9

line | stmt | bran | cond | sub | pod | time | code
--- | --- | --- | --- | --- | --- | --- | ---
1 |  |  |  |  |  |  | package Prancer::Session::State::Cookie;
2 |  |  |  |  |  |  |
3 | 4 |  |  | 4 |  | 4051 | use strict;
| 4 |  |  |  |  | 4 |
| 4 |  |  |  |  | 112 |
4 | 4 |  |  | 4 |  | 10 | use warnings FATAL => 'all';
| 4 |  |  |  |  | 3 |
| 4 |  |  |  |  | 89 |
5 |  |  |  |  |  |  |
6 | 4 |  |  | 4 |  | 779 | use Plack::Session::State::Cookie;
| 4 |  |  |  |  | 11289 |
| 4 |  |  |  |  | 140 |
7 | 4 |  |  | 4 |  | 20 | use parent qw(Plack::Session::State::Cookie);
| 4 |  |  |  |  | 5 |
| 4 |  |  |  |  | 18 |
8 |  |  |  |  |  |  |
9 |  |  |  |  |  |  | # this module does not require any additional settings. we override the parent
10 |  |  |  |  |  |  | # module almost strictly for semantics and maybe some day (but probably not)
11 |  |  |  |  |  |  | # this module might be replaced by a different, homegrown version.
12 |  |  |  |  |  |  |
13 |  |  |  |  |  |  | sub new {
14 | 0 |  |  | 0 | 1 |  | my ($class, $config) = @_;
15 | 0 | 0 |  |  |  |  | return bless($class->SUPER::new(%{$config || {}}), $class);
| 0 |  |  |  |  |  |
16 |  |  |  |  |  |  | }
17 |  |  |  |  |  |  |
18 |  |  |  |  |  |  | 1;
19 |  |  |  |  |  |  |
20 |  |  |  |  |  |  | =head1 NAME
21 |  |  |  |  |  |  |
22 |  |  |  |  |  |  | Prancer::Session::State::Cookie
23 |  |  |  |  |  |  |
24 |  |  |  |  |  |  | =head1 SYNOPSIS
25 |  |  |  |  |  |  |
26 |  |  |  |  |  |  | THis module enables a session state handler. NOTE: One should not use this
27 |  |  |  |  |  |  | module to connect to the database. Instead, one should use L<Prancer::Context>.
28 |  |  |  |  |  |  |
29 |  |  |  |  |  |  | This module implements a session state handler. It will keep track of sessions
30 |  |  |  |  |  |  | by setting cookies into the response headers and reading cookies in the request
31 |  |  |  |  |  |  | headers. You must enable this if you want sessions to work.
32 |  |  |  |  |  |  |
33 |  |  |  |  |  |  | To use this session state handler, add this to your configuration file:
34 |  |  |  |  |  |  |
35 |  |  |  |  |  |  | session:
36 |  |  |  |  |  |  | state:
37 |  |  |  |  |  |  | driver: Prancer::Session::State::Cookie
38 |  |  |  |  |  |  | options:
39 |  |  |  |  |  |  | key: PSESSION
40 |  |  |  |  |  |  | path: /
41 |  |  |  |  |  |  | domain: .example.com
42 |  |  |  |  |  |  | # expires in 30 minutes
43 |  |  |  |  |  |  | expires: 1800
44 |  |  |  |  |  |  | secure: 1
45 |  |  |  |  |  |  | httponly: 1
46 |  |  |  |  |  |  |
47 |  |  |  |  |  |  | =head1 OPTIONS
48 |  |  |  |  |  |  |
49 |  |  |  |  |  |  | =over 4
50 |  |  |  |  |  |  |
51 |  |  |  |  |  |  | =item key
52 |  |  |  |  |  |  |
53 |  |  |  |  |  |  | Set the name of the cookie. The default is B<PSESSION>.
54 |  |  |  |  |  |  |
55 |  |  |  |  |  |  | =item path
56 |  |  |  |  |  |  |
57 |  |  |  |  |  |  | Path of the cookie, this defaults to "/";
58 |  |  |  |  |  |  |
59 |  |  |  |  |  |  | =item domain
60 |  |  |  |  |  |  |
61 |  |  |  |  |  |  | Domain of the cookie. If nothing is supplied then it will not be included in
62 |  |  |  |  |  |  | the cookie.
63 |  |  |  |  |  |  |
64 |  |  |  |  |  |  | =item expires
65 |  |  |  |  |  |  |
66 |  |  |  |  |  |  | Expiration time of the cookie in seconds. If nothing is supplied then it will
67 |  |  |  |  |  |  | not be included in the cookie, which means the session expires per browser
68 |  |  |  |  |  |  | session.
69 |  |  |  |  |  |  |
70 |  |  |  |  |  |  | =item secure
71 |  |  |  |  |  |  |
72 |  |  |  |  |  |  | Secure flag for the cookie. If nothing is supplied then it will not be included
73 |  |  |  |  |  |  | in the cookie. If this is set then the cookie will only be transmitted on
74 |  |  |  |  |  |  | secure connections.
75 |  |  |  |  |  |  |
76 |  |  |  |  |  |  | =item httponly
77 |  |  |  |  |  |  |
78 |  |  |  |  |  |  | HttpOnly flag for the cookie. If nothing is supplied then it will not be
79 |  |  |  |  |  |  | included in the cookie. If this is set then the cookie will only be accessible
80 |  |  |  |  |  |  | by the server and not by, say, JavaScript.
81 |  |  |  |  |  |  |
82 |  |  |  |  |  |  | =back
83 |  |  |  |  |  |  |
84 |  |  |  |  |  |  | =cut
85 |  |  |  |  |  |  |