line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Session; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
972
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
92
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
388
|
use MojoX::Session; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub register { |
11
|
1
|
|
|
1
|
1
|
40
|
my ($self, $app, $args) = @_; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
50
|
|
|
4
|
$args ||= {}; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
50
|
|
|
3
|
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
|
|
77667
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
28
|
my $session = MojoX::Session->new(%$args); |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
54
|
$session->tx($self->tx); |
25
|
|
|
|
|
|
|
|
26
|
3
|
50
|
|
|
|
86
|
$init->($self, $session) if $init; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
69
|
$self->stash($stash_key => $session); |
29
|
|
|
|
|
|
|
} |
30
|
1
|
|
|
|
|
12
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$app->hook( |
33
|
|
|
|
|
|
|
after_dispatch => sub { |
34
|
3
|
|
|
3
|
|
13082
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
11
|
$self->stash($stash_key)->flush; |
37
|
|
|
|
|
|
|
} |
38
|
1
|
|
|
|
|
40
|
); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |