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

filter: Statementstmt 91.6% 99 / 108 Branchbran 71.4% 30 / 42 Conditioncond 66.6% 10 / 15 MC/DCmcdc 37.5% 3 / 8 Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 2 totaltotal 81.9% 154 / 188 CC 36 SCAR 20.4
CC
36
Cov
84%
_FileGKFAS
13.7
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 66 our $VERSION = '2.19.0';
19  
20 270 ▶sub _load {
Subroutine _load: called CC=4 SCAR=17.1
21 270 my ( $backend, $func ) = @_;
22 270 ▶ unless ( $backend->can('populate') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($backend->can("populate")) 0 270 270
23 0 eval "require $backend";
24 0 ▶ die $@ if ($@);
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
25 }
26 270 ▶ return $func ? $backend->can($func) : 0;
Branch: 1 branch
BranchTrueFalseTotal
$func ? : 73 197 270
27 }
28  
29 197 ▶sub populate {
Subroutine populate: called CC=11 SCAR=24.6
Pod undocumented
30 197 my $self = shift;
31 197 my $backend = $self->{args}->{backend};
32 197 _load($backend);
33 197 $backend .= "::populate";
34 {
35 7 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
36 197 $self = $self->$backend(@_);
37 }
38 197 ▶ 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"}) 197 0 197
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
00197
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 197 \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::serialize;
44 $self->{unserialize} =
45 197 \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::unserialize;
46 197 ▶ if ( $backend =~ /^Apache::Session::LDAP/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($backend =~ /^Apache::Session::LDAP/) 0 197 197
47 $self->{unserialize} =
48 0 \&Lemonldap::NG::Common::Apache::Session::Serialize::JSON::unserializeBase64;
49 }
50 }
51 197 ▶ if ( $self->{args}->{generateModule} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"args"}{"generateModule"}) 2 195 197
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 197 ▶ if ( $self->{args}->{setId} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"args"}{"setId"}) 13 184 197
59 13 $self->{generate} = \&setId;
60 0 ▶ $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 197 ▶ : 0
Branch: 1 branch
BranchTrueFalseTotal
$self->{'args'}{'localStorageOptions'} ? : 6 191 197
67 );
68  
69 # If cache is configured, use our specific object store module
70 197 ▶ if ( ( $> or $allow_cache_for_root )
Branch: 1 branch
BranchTrueFalseTotal
if ($> || $allow_cache_for_root and $self->{"args"}{"localStorage"}) 6 191 197
Condition50%3/6
$> || $allow_cache_for_root and $self->{"args"}{"localStorage"}
!ll&&!rl&&r
01916
$> or $allow_cache_for_root
l!l&&r!l&&!r
19700
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 197 return $self;
81 }
82  
83 __END__
« blib/lib/Lemonldap/NG/Common/Conf/Backends/Overlay.pm ↑ Summary blib/lib/Lemonldap/NG/Common/Combination/Parser.pm »