File Coverage

blib/lib/Mojolicious/Plugin/Sessionless.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 32 32 100.0


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::Sessionless 0.01;
2 2     2   1326350 use v5.26;
  2         9  
3 2     2   10 use warnings;
  2         3  
  2         121  
4              
5             # ABSTRACT: Installs noop handlers to disable Mojolicious sessions
6              
7             =encoding UTF-8
8              
9             =head1 NAME
10              
11             Mojolicious::Plugin::Sessionless - disable Mojolicious sessions
12              
13             =head1 SYNOPSIS
14              
15             plugin 'Sessionless';
16              
17             app->session(key => 'value'); #noop
18              
19             =head1 DESCRIPTION
20              
21             L is an extremely simple plugin that disables
22             Mojolicious's session support, replacing the Session load/save handlers with
23             Cs
24              
25             =head1 METHODS
26              
27             L inherits all methods from L
28             and implements the following new onees
29              
30             =head2 register
31              
32             Register plugin in L application. Takes no parameters.
33              
34             =head2 load
35              
36             Load session data. Noop.
37              
38             =head2 store
39              
40             Store session data. Noop.
41              
42             =cut
43              
44 2     2   586 use Mojo::Base 'Mojolicious::Plugin';
  2         11965  
  2         14  
45              
46 2     2   1847 use experimental qw(signatures);
  2         3485  
  2         11  
47              
48 1     1 1 36 sub register($self, $app, $conf) {
  1         2  
  1         1  
  1         2  
  1         2  
49 1         12 $app->sessions(bless({}, '__Sessionless'));
50             {
51 2     2   228 no strict 'refs';
  2         3  
  2         225  
  1         6  
52 1     6   3 *{'__Sessionless::load'} = *{'__Sessionless::store'} = sub { };
  1         6  
  1         8  
53             }
54             }
55              
56             =head1 AUTHOR
57              
58             Mark Tyrrell C<< >>
59              
60             =head1 LICENSE
61              
62             Copyright (c) 2024 Mark Tyrrell
63              
64             Permission is hereby granted, free of charge, to any person obtaining a copy
65             of this software and associated documentation files (the "Software"), to deal
66             in the Software without restriction, including without limitation the rights
67             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
68             copies of the Software, and to permit persons to whom the Software is
69             furnished to do so, subject to the following conditions:
70              
71             The above copyright notice and this permission notice shall be included in all
72             copies or substantial portions of the Software.
73              
74             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
75             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
76             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
77             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
78             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
79             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
80             SOFTWARE.
81              
82             =cut
83              
84             1;
85              
86             __END__