| 1 | package Mojolicious::Plugin::Sessionless 0.01; | ||
| 2 | 1 | ▶ | use v5.26; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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<Mojolicious::Plugin::Sessionless> is an extremely simple plugin that disables | ||
| 22 | Mojolicious's session support, replacing the Session load/save handlers with | ||
| 23 | C<noop>s | ||
| 24 | |||
| 25 | =head1 METHODS | ||
| 26 | |||
| 27 | L<Mojolicious::Plugin::Sessionless> inherits all methods from L<Mojolicious::Plugin> | ||
| 28 | and implements the following new onees | ||
| 29 | |||
| 30 | =head2 register | ||
| 31 | |||
| 32 | Register plugin in L<Mojolicious> 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 | 0 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 45 | |||
| 46 | use experimental qw(signatures); | ||
| 47 | |||
| 48 | sub register($self, $app, $conf) { | ||
| 49 | $app->sessions(bless({}, '__Sessionless')); | ||
| 50 | { | ||
| 51 | no strict 'refs'; | ||
| 52 | *{'__Sessionless::load'} = *{'__Sessionless::store'} = sub { }; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | =head1 AUTHOR | ||
| 57 | |||
| 58 | Mark Tyrrell C<< <mark@tyrrminal.dev> >> | ||
| 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__ | ||