line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::MtPolicyd::SessionCache; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
8
|
use Moose; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '2.01'; # VERSION |
6
|
|
|
|
|
|
|
# ABSTRACT: class for handling session cache |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
8896
|
use Mail::MtPolicyd::SessionCache::None; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
408
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'server' => ( |
11
|
|
|
|
|
|
|
is => 'ro', isa => 'Net::Server', required => 1, |
12
|
|
|
|
|
|
|
handles => { |
13
|
|
|
|
|
|
|
'log' => 'log', |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'cache' => ( |
18
|
|
|
|
|
|
|
is => 'rw', isa => 'Mail::MtPolicyd::SessionCache::Base', |
19
|
|
|
|
|
|
|
lazy => 1, |
20
|
|
|
|
|
|
|
default => sub { Mail::MtPolicyd::SessionCache::None->new }, |
21
|
|
|
|
|
|
|
handles => [ |
22
|
|
|
|
|
|
|
'retrieve_session', 'store_session', 'shutdown', |
23
|
|
|
|
|
|
|
], |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub load_config { |
27
|
0
|
|
|
0
|
0
|
|
my ( $self, $config ) = @_; |
28
|
0
|
0
|
|
|
|
|
if( ! defined $config->{'module'} ) { |
29
|
0
|
|
|
|
|
|
die('no module defined for SessionCache!'); |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
my $module = $config->{'module'}; |
32
|
0
|
|
|
|
|
|
my $class = 'Mail::MtPolicyd::SessionCache::'.$module; |
33
|
0
|
|
|
|
|
|
my $cache; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$self->log(1, 'loading SessionCache '.$module); |
36
|
0
|
|
|
|
|
|
my $code = "require ".$class.";"; |
37
|
0
|
|
|
|
|
|
eval $code; ## no critic (ProhibitStringyEval) |
38
|
0
|
0
|
|
|
|
|
if($@) { |
39
|
0
|
|
|
|
|
|
die('could not load SessionCache '.$module.': '.$@); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$self->log(1, 'initializing SessionCache '.$module); |
43
|
0
|
|
|
|
|
|
eval { |
44
|
0
|
|
|
|
|
|
$cache = $class->new( |
45
|
|
|
|
|
|
|
%$config, |
46
|
|
|
|
|
|
|
); |
47
|
0
|
|
|
|
|
|
$cache->init(); |
48
|
|
|
|
|
|
|
}; |
49
|
0
|
0
|
|
|
|
|
if($@) { |
50
|
0
|
|
|
|
|
|
die('could not initialize SessionCache: '.$@); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
$self->cache( $cache ); |
53
|
0
|
|
|
|
|
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding UTF-8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Mail::MtPolicyd::SessionCache - class for handling session cache |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 VERSION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
version 2.01 |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Markus Benning <ich@markusbenning.de> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>. |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This is free software, licensed under: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
The GNU General Public License, Version 2, June 1991 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |