File Coverage

blib/lib/Mojolicious/Plugin/Sessions3S.pm
Criterion Covered Total %
statement 17 18 94.4
branch 1 2 50.0
condition 2 4 50.0
subroutine 5 5 100.0
pod 1 1 100.0
total 26 30 86.6


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::Sessions3S;
2             # ABSTRACT: Manage Sessions Storage, State and Sid generation in Mojolicious
3             $Mojolicious::Plugin::Sessions3S::VERSION = '0.003';
4             =head1 NAME
5              
6             Mojolicious::Plugin::Sessions3S - Manage mojolicious sessions Storage, State and SID generation
7              
8             =head1 DESCRIPTION
9              
10             This plugins puts you in control of how your sessions are stored, how the state persists
11             in the client browser and how session Ids are generated.
12              
13             It provides a drop in replacement for the standard Mojolicious::Sessions mechanism and
14             will NOT require any change of your application code (except the setup of course).
15              
16             =head1 SYNOPSIS
17              
18             $app->plugin( 'Sessions3S' => {
19             state => ..,
20             storage => ...,
21             sidgen => ...
22             });
23              
24             See L for the parameters description.
25              
26             If no arguments are provided, this fallsback to the stock L behaviour.
27              
28             =cut
29              
30 2     2   57582 use strict;
  2         4  
  2         61  
31 2     2   7 use warnings;
  2         4  
  2         59  
32 2     2   9 use Mojo::Base 'Mojolicious::Plugin';
  2         11  
  2         17  
33              
34 2     2   1146 use Mojolicious::Sessions::ThreeS;
  2         4  
  2         15  
35              
36             =head2 register
37              
38             Implementation for L base class
39              
40             =cut
41              
42             sub register{
43 3     3 1 3151 my ($self, $app, $args) = @_;
44 3   50     9 $args ||= {};
45 3 50 50     14 unless( ( ref($args) || '' ) eq 'HASH' ){
46 0         0 confess("Argument to ".ref($self)." should be an HashRef");
47             }
48 3         11 my $sessions_manager = Mojolicious::Sessions::ThreeS->new( $args );
49 3         13 $app->sessions( $sessions_manager );
50             }
51              
52             =head1 COPYRIGHT
53              
54             This is copyright Jerome Eteve (JETEVE) 2016
55              
56             With the support of Broadbean UK Ltd. L
57              
58             =cut
59              
60             1;