line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Session; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1706
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
115
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
631
|
use MojoX::Session; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
11
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub register { |
11
|
1
|
|
|
1
|
1
|
66
|
my ($self, $app, $args) = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
50
|
|
|
6
|
$args ||= {}; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
50
|
|
|
6
|
my $stash_key = delete $args->{stash_key} || 'mojox-session'; |
16
|
1
|
|
|
|
|
2
|
my $init = delete $args->{init}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
$app->hook( |
19
|
|
|
|
|
|
|
before_dispatch => sub { |
20
|
3
|
|
|
3
|
|
133837
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
39
|
my $session = MojoX::Session->new(%$args); |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
81
|
$session->tx($self->tx); |
25
|
|
|
|
|
|
|
|
26
|
3
|
50
|
|
|
|
119
|
$init->($self, $session) if $init; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
93
|
$self->stash($stash_key => $session); |
29
|
|
|
|
|
|
|
} |
30
|
1
|
|
|
|
|
15
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$app->hook( |
33
|
|
|
|
|
|
|
after_dispatch => sub { |
34
|
3
|
|
|
3
|
|
20232
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
15
|
$self->stash($stash_key)->flush; |
37
|
|
|
|
|
|
|
} |
38
|
1
|
|
|
|
|
54
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |