| 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 ||= {}
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
| |||||||||||||
| 14 | |||||||||||||
| 15 | 1 | ▶ | my $stash_key = delete $args->{stash_key} || 'mojox-session'; | ||||||||||
|
Condition50%1/2
delete $args->{'stash_key'} || 'mojox-session'
MC/DC0%0/1
delete $args->{'stash_key'} || 'mojox-session'
delete $args->{'stash_key'}
Truth table50%1/2
A
A= delete $args->{'stash_key'}
| |||||||||||||
| 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
| |||||||||||||
| 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__ | ||||||||||||