Mojolicious/Plugin/Session.pm

filter: Statementstmt 100% 26 / 26 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 88.1% 37 / 42 CC 4 SCAR 5.9
CC
4
Cov
91%
register
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.8
« MojoX/Session/Transport/Cookie.pm ↑ Summary MojoX/Session/Store.pm »
1 package Mojolicious::Plugin::Session;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use base 'Mojolicious::Plugin';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use MojoX::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶sub register {
Subroutine register: called CC=3 SCAR=11.1
Pod documented
11 1 my ($self, $app, $args) = @_;
12  
13 1 ▶ $args ||= {};
Condition50%1/2
$args ||= {}
l!l
10
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
14  
15 1 ▶ my $stash_key = delete $args->{stash_key} || 'mojox-session';
Condition50%1/2
delete $args->{'stash_key'} || 'mojox-session'
l!l
10
MC/DC0%0/1
delete $args->{'stash_key'} || 'mojox-session'
delete $args->{'stash_key'}
Truth table50%1/2
A
A= delete $args->{'stash_key'}
Aresult
11
00
16 1 my $init = delete $args->{init};
17  
18 $app->hook(
19 3 ▶ before_dispatch => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
20 3 my $self = shift;
21  
22 3 my $session = MojoX::Session->new(%$args);
23  
24 3 $session->tx($self->tx);
25  
26 3 ▶ $init->($self, $session) if $init;
Branch: 1 branch
BranchTrueFalseTotal
if $init 3 0 3
27  
28 3 $self->stash($stash_key => $session);
29 }
30 1 );
31  
32 $app->hook(
33 3 ▶ after_dispatch => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
34 3 my $self = shift;
35  
36 3 $self->stash($stash_key)->flush;
37 }
38 1 );
39 }
40  
41 1 1;
42 __END__
« MojoX/Session/Transport/Cookie.pm ↑ Summary MojoX/Session/Store.pm »