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

filter: Statementstmt 93.7% 45 / 48 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 7 totaltotal 83.3% 60 / 72 CC 3 SCAR 2.9
CC
3
Cov
92%
cache
2.0
acquire_read_lock
2.0
release_write_lock
2.0
CRAP 1.3
« blib/lib/Lemonldap/NG/Common/Regexp.pm ↑ Summary blib/lib/Lemonldap/NG/Common/EmailTransport.pm »
1  
2 package Lemonldap::NG::Common::Apache::Session::Lock;
3  
4 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 our $VERSION = '2.0.0';
7  
8 sub new {
9 6 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10 6 my $session = shift;
11  
12 6 my $self = {};
13 6 $self->{args} = $session->{args};
14 6 bless $self, $class;
15 6 return $self;
16 }
17  
18 sub module {
19 11 ▶ my $self = shift;
Subroutine module: called CC=1 SCAR=0.0
Pod undocumented
20 11 return $self->{args}->{lock_manager};
21 }
22  
23 sub cache {
24 5 ▶ my $self = shift;
Subroutine cache: called CC=2 SCAR=6.9
Pod undocumented
25  
26 5 ▶ return $self->{cache} if $self->{cache};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"cache"} 0 5 5
27  
28 5 my $module = $self->{args}->{localStorage};
29 5 ▶ eval "use $module;";
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
30 5 $self->{cache} = $module->new( $self->{args}->{localStorageOptions} );
31  
32 5 return $self->{cache};
33 }
34  
35 sub acquire_read_lock {
36 5 ▶ my $self = shift;
Subroutine acquire_read_lock: called CC=2 SCAR=6.9
Pod undocumented
37 5 my $session = shift;
38  
39 # Get session from cache
40 5 my $id = $session->{data}->{_session_id};
41 5 ▶ if ( $self->cache->get($id) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->cache->get($id)) { } 2 3 5
42  
43 # got session from cache, no need to ask for locks
44 }
45 else {
46 3 $self->module->acquire_read_lock($session);
47 }
48 }
49  
50 sub acquire_write_lock {
51 2 ▶ my $self = shift;
Subroutine acquire_write_lock: called CC=1 SCAR=0.0
Pod undocumented
52 2 my $session = shift;
53  
54 2 $self->module->acquire_write_lock($session);
55 }
56  
57 sub release_write_lock {
58 0 ▶ my $self = shift;
Subroutine release_write_lock: not called CC=1 SCAR=6.9
Pod undocumented
59 0 my $session = shift;
60  
61 0 $self->module->release_write_lock($session);
62 }
63  
64 sub release_all_locks {
65 6 ▶ my $self = shift;
Subroutine release_all_locks: called CC=1 SCAR=0.0
Pod undocumented
66 6 my $session = shift;
67  
68 6 $self->module->release_all_locks($session);
69 }
70  
71 7 1;
72  
« blib/lib/Lemonldap/NG/Common/Regexp.pm ↑ Summary blib/lib/Lemonldap/NG/Common/EmailTransport.pm »