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.002';
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   54255 use strict;
  2         2  
  2         48  
31 2     2   6 use warnings;
  2         3  
  2         39  
32 2     2   7 use Mojo::Base 'Mojolicious::Plugin';
  2         7  
  2         12  
33              
34 2     2   1037 use Mojolicious::Sessions::ThreeS;
  2         2  
  2         15  
35              
36             =head2 register
37              
38             Implementation for L base class
39              
40             =cut
41              
42             sub register{
43 3     3 1 2831 my ($self, $app, $args) = @_;
44 3   50     10 $args ||= {};
45 3 50 50     12 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         12 $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;