blib/lib/Lemonldap/NG/Common/Apache/Session.pm

filter: Statementstmt 91.6% 99 / 108 Branchbran 72.7% 32 / 44 Conditioncond 58.3% 7 / 12 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 2 totaltotal 81.6% 151 / 185 CC 36 SCAR 20.4
CC
36
Cov
84%
_FileGKFAS
13.8
populate
11.7
_load
5.5
CRAP 7.7
« blib/lib/Lemonldap/NG/Common/Conf/Backends/Overlay.pm ↑ Summary blib/lib/Lemonldap/NG/Common/Combination/Parser.pm »
1 # @file
2 # Add get_key_from_all_sessions() function to Apache::Session modules.
3 # This file is used by Lemonldap::NG::Manager::Status and by the
4 # purgeCentralCache script.
5 #
6 # Warning, this works only with SQL databases, simple or Berkeley files (not
7 # for Apache::Session::Memcached for example)
8 package Lemonldap::NG::Common::Apache::Session;
9  
10 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 7 ▶use AutoLoader 'AUTOLOAD';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 7 ▶use Apache::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 7 ▶use base qw(Apache::Session);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 7 ▶use Lemonldap::NG::Common::Apache::Session::Serialize::JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 7 ▶use Lemonldap::NG::Common::Apache::Session::Store;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 7 ▶use Lemonldap::NG::Common::Apache::Session::Lock;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 60 our $VERSION = '2.19.0';
19  
20 sub _load {
21 258 ▶ my ( $backend, $func ) = @_;
Subroutine _load: called CC=4 SCAR=17.1
22 258 ▶ unless ( $backend->can('populate') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($backend->can("populate")) 0 258 258
23 0 eval "require $backend";
24 0 ▶ die $@ if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
25 }
26 258 ▶ return $func ? $backend->can($func) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$func ? : 67 191 258
27 }
28  
29 sub populate {
30 191 ▶ my $self = shift;
Subroutine populate: called CC=11 SCAR=24.6
Pod undocumented
31 191 my $backend = $self->{args}->{backend};
32 191 _load($backend);
33 191 $backend .= "::populate";
34 {
35 7 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
36 191 $self = $self->$backend(@_);
37 }
38 191 ▶ if ( $backend =~
Branch: 1 branch
BranchTrueFalseTotal
if ($backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/ and not $self->{"args"}{"useStorable"}) 191 0 191
Condition33%1/3
$backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/ and not $self->{"args"}{"useStorable"}
!ll&&!rl&&r
00191
MC/DC0%0/2
$backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/ and not $self->{"args"}{"useStorable"}
$backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/ not $self->{"args"}{"useStorable"}
Truth table33%1/3
A and not(B)
A= $backend =~ /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/B= not $self->{"args"}{"useStorable"}
ABresult
0X0
100
111
39 /^Apache::Session::(?:(?:Postgre|Redi)s|S(?:QLite3|ybase)|(?:My|No)SQL|F(?:ile|lex)|Cassandra|Oracle|LDAP)/
40 and !$self->{args}->{useStorable} )
41 {
42 $self->{serialize} =
43 191 \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::serialize;
44 $self->{unserialize} =
45 191 \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::unserialize;
46 191 ▶ if ( $backend =~ /^Apache::Session::LDAP/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($backend =~ /^Apache::Session::LDAP/) 0 191 191
47 $self->{unserialize} =
48 0 \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::unserializeBase64;
49 }
50 }
51 191 ▶ if ( $self->{args}->{generateModule} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"args"}{"generateModule"}) 2 189 191
52 2 my $generate = $self->{args}->{generateModule};
53 2 eval "require $generate";
54 2 ▶ die $@ if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 2 2
55 2 $self->{generate} = \&{ $generate . "::generate" };
56 2 $self->{validate} = \&{ $generate . "::validate" };
57 }
58 191 ▶ if ( $self->{args}->{setId} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"args"}{"setId"}) 13 178 191
59 13 $self->{generate} = \&setId;
60 13 ▶ $self->{validate} = sub { 1 };
Subroutine __ANON__: not called CC=1 SCAR=1.2
61 }
62  
63 my $allow_cache_for_root = (
64 $self->{args}->{localStorageOptions}
65 ? $self->{args}->{localStorageOptions}->{allow_cache_for_root}
66 191 ▶ : 0
Branch: 1 branch
BranchTrueFalseTotal
$self->{'args'}{'localStorageOptions'} ? : 6 185 191
67 );
68  
69 # If cache is configured, use our specific object store module
70 191 ▶ if ( ( $> or $allow_cache_for_root )
Branch: 1 branch
BranchTrueFalseTotal
if ($> || $allow_cache_for_root and $self->{"args"}{"localStorage"}) 6 185 191
Condition50%3/6
$> || $allow_cache_for_root and $self->{"args"}{"localStorage"}
!ll&&!rl&&r
01856
$> or $allow_cache_for_root
l!l&&r!l&&!r
19100
MC/DC33%1/3
$> || $allow_cache_for_root and $self->{"args"}{"localStorage"}
$> $allow_cache_for_root $self->{"args"}{"localStorage"}
Truth table40%2/5
A or B and C
A= $>B= $allow_cache_for_rootC= $self->{"args"}{"localStorage"}
ABCresult
00X0
1X00
0100
1X11
0111
71 and $self->{args}->{localStorage} )
72 {
73 6 $self->{args}->{object_store} = $self->{object_store};
74 $self->{object_store} =
75 6 Lemonldap::NG::Common::Apache::Session::Store->new($self);
76 6 $self->{args}->{lock_manager} = $self->{lock_manager};
77 $self->{lock_manager} =
78 6 Lemonldap::NG::Common::Apache::Session::Lock->new($self);
79 }
80 191 return $self;
81 }
82  
83 __END__
« blib/lib/Lemonldap/NG/Common/Conf/Backends/Overlay.pm ↑ Summary blib/lib/Lemonldap/NG/Common/Combination/Parser.pm »