SessionX/Manager.pm

filter: Statementstmt 29.5% 13 / 44 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 6 totaltotal 22.3% 17 / 76 CC 8 SCAR 28.2
CC
8
Cov
23%
new
42.0
first_session
6.0
next_session
6.0
CRAP 16.8
« SessionX.pm ↑ Summary SessionX/Store/File.pm »
1 ###################################################################################
2 #
3 # Apache::SessionX - Copyright (c) 1999-2001 Gerald Richter / ecos gmbh
4 # Copyright(c) 1998, 1999 Jeffrey William Baker (jeffrey@kathyandjeffrey.net)
5 #
6 # You may distribute under the terms of either the GNU General Public
7 # License or the Artistic License, as specified in the Perl README file.
8 #
9 # THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
10 # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
11 # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 #
13 # $Id: Manager.pm,v 1.1 2002/03/12 08:50:32 richter Exp $
14 #
15 ###################################################################################
16  
17  
18 package Apache::SessionX::Manager ;
19  
20 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use vars qw(@ISA $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 1 $VERSION = '2.00b5';
24  
25 1 ▶use Apache::Session;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use Apache::SessionX::Config ;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 sub new
29 0 ▶ {
Subroutine new: not called CC=6 SCAR=37.4
Pod undocumented
30 0 my $class = shift;
31
32 0 ▶ my $args = shift || {};
Condition0%0/2
shift() || {}
l!l
00
MC/DC0%0/1
shift() || {}
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
33  
34 0 ▶ if(ref $args ne "HASH")
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args ne "HASH") 0 0 0
35 {
36 0 die "Additional arguments should be in the form of a hash reference";
37 }
38  
39 0 ▶ my $config = $args -> {config} || $Apache::SessionX::Config::default;
Condition0%0/3
$args->{'config'} || $Apache::SessionX::Config::default
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{'config'} || $Apache::SessionX::Config::default
$args->{'config'} $Apache::SessionX::Config::default
Truth table0%0/3
A || B
A= $args->{'config'}B= $Apache::SessionX::Config::default
ABresult
1X1
011
000
40 0 foreach my $cfg (keys (%{$Apache::SessionX::Config::param{$config}}))
41 {
42 0 ▶ $args -> {$cfg} = $Apache::SessionX::Config::param{$config} -> {$cfg} if (!exists $args -> {$cfg}) ;
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args->{$cfg} 0 0 0
43 }
44
45 0 my $self =
46 {
47 args => $args,
48 };
49
50 0 bless $self, $class;
51  
52 0 Apache::SessionX -> require_modules ($args) ;
53 0 Apache::SessionX::populate ($self) ;
54  
55  
56 0 return $self ;
57 }
58  
59  
60 sub count_sessions
61 0 ▶ {
Subroutine count_sessions: not called CC=1 SCAR=6.9
Pod undocumented
62 0 my $self = shift;
63 0 return $self->{object_store}->count_sessions($self);
64 }
65
66 sub first_session_id
67 0 ▶ {
Subroutine first_session_id: not called CC=1 SCAR=6.9
Pod undocumented
68 0 my $self = shift;
69 0 return $self->{object_store}->first_session_id($self);
70 }
71
72 sub next_session_id
73 0 ▶ {
Subroutine next_session_id: not called CC=1 SCAR=6.9
Pod undocumented
74 0 my $self = shift;
75 0 return $self->{object_store}->next_session_id($self);
76 }
77
78 sub first_session
79 0 ▶ {
Subroutine first_session: not called CC=2 SCAR=17.9
Pod undocumented
80 0 my $self = shift;
81 0 my %session ;
82 0 my $id = $self -> first_session_id ;
83  
84 0 ▶ return undef if (!$id) ;
Branch: 1 branch
BranchTrueFalseTotal
unless $id 0 0 0
85  
86 0 tie %session, 'Apache::SessionX', $id, $self -> {args} ;
87
88 0 return \%session ;
89 }
90
91 sub next_session
92 0 ▶ {
Subroutine next_session: not called CC=2 SCAR=17.9
Pod undocumented
93 0 my $self = shift;
94 0 my $id = $self -> next_session_id ;
95 0 my %session ;
96  
97 0 ▶ return undef if (!$id) ;
Branch: 1 branch
BranchTrueFalseTotal
unless $id 0 0 0
98  
99 0 tie %session, 'Apache::SessionX', $id, $self -> {args} ;
100
101 0 return \%session ;
102 }
103
« SessionX.pm ↑ Summary SessionX/Store/File.pm »