| 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: SessionX.pm,v 1.4 2001/12/04 13:33:39 richter Exp $ | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||||||||||||
| 15 | ################################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | package Apache::SessionX ; | ||||||||||||||||||||||||||||||||||||||||||
| 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.01'; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | @ISA = qw(Apache::Session); | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use Apache::Session; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use Apache::SessionX::Config ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | use constant NEW => Apache::Session::NEW () ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | use constant MODIFIED => Apache::Session::MODIFIED () ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | use constant DELETED => Apache::Session::DELETED () ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use constant SYNCED => Apache::Session::SYNCED () ; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | ▶ | sub TIEHASH { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TIEHASH: called CC=7 SCAR=23.2
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 2 | my $session_id = shift; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | ▶ | my $args = shift || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 2 | ▶ | if(ref $args ne "HASH") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | { | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | die "Additional arguments should be in the form of a hash reference"; | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | ▶ | my $config = $args -> {config} || $Apache::SessionX::Config::default; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$args->{'config'} || $Apache::SessionX::Config::default
MC/DC0%0/2
$args->{'config'} || $Apache::SessionX::Config::default
$args->{'config'}
$Apache::SessionX::Config::default
Truth table33%1/3
A || B
A= $args->{'config'}B= $Apache::SessionX::Config::default
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 2 | foreach my $cfg (keys (%{$Apache::SessionX::Config::param{$config}})) | |||||||||||||||||||||||||||||||||||||||||
| 48 | { | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 14 | ▶ | $args -> {$cfg} = $Apache::SessionX::Config::param{$config} -> {$cfg} if (!exists $args -> {$cfg}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | my $self = | ||||||||||||||||||||||||||||||||||||||||||
| 53 | { | ||||||||||||||||||||||||||||||||||||||||||
| 54 | args => $args, | ||||||||||||||||||||||||||||||||||||||||||
| 55 | data => { _session_id => $session_id }, | ||||||||||||||||||||||||||||||||||||||||||
| 56 | initial_session_id => $session_id, | ||||||||||||||||||||||||||||||||||||||||||
| 57 | lock => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 58 | lock_manager => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | object_store => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | status => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | serialized => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | idfrom => $args -> {idfrom}, | ||||||||||||||||||||||||||||||||||||||||||
| 63 | newid => $args -> {newid}, | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 2 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | $self -> require_modules ($args) ; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | $self -> init if (!$args -> {'lazy'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | return $self ; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | sub require_modules | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
require_modules: called CC=7 SCAR=22.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 2 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 2 | my $args = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | # check object_store and lock_manager classes (Apache::Session 1.00) | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | foreach my $mod ('Store', 'Lock', 'Generate', 'Serialize') | |||||||||||||||||||||||||||||||||||||||||
| 85 | { | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 2 | ▶ | if ($args -> {$mod}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 2 | ▶ | if (!($args -> {$mod} =~ /::/)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | { | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 2 | my $modname = "Apache::SessionX::$mod\:\:$args->{$mod}" ; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 2 | eval "require $modname" ; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | ▶ | if ($@) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 2 | $@ = '' ; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | $modname = "Apache::Session::$mod\:\:$args->{$mod}" ; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 2 | eval "require $modname" ; | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | ▶ | die "Cannot require $modname ($@)" if ($@) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $args->{$mod} = $modname ; | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | else | ||||||||||||||||||||||||||||||||||||||||||
| 103 | { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $modname = $args->{$mod} ; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | eval "require $modname" ; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | die "Cannot require $modname" if ($@) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | sub init | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $self = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | #If a session ID was passed in, this is an old hash. | ||||||||||||||||||||||||||||||||||||||||||
| 121 | #If not, it is a fresh one. | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $self->populate; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $session_id = $self->{data}->{_session_id} ; | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if (!$session_id && $self -> {idfrom}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $session_id and $self->{"idfrom"}
MC/DC0%0/2
not $session_id and $self->{"idfrom"}
not $session_id
$self->{"idfrom"}
Truth table0%0/3
not(A) and B
A= not $session_idB= $self->{"idfrom"}
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | { | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $session_id = $self->{data}->{_session_id} = &{$self->{generate}}($self, $self -> {idfrom}) ; | |||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | $self->{initial_session_id} ||= $session_id ; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"initial_session_id"} ||= $session_id
MC/DC0%0/2
$self->{"initial_session_id"} ||= $session_id
$self->{"initial_session_id"}
$session_id
Truth table0%0/3
A ||= B
A= $self->{"initial_session_id"}B= $session_id
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if (defined $session_id && $session_id) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $session_id and $session_id
MC/DC0%0/2
defined $session_id and $session_id
defined $session_id
$session_id
Truth table0%0/3
A and B
A= defined $session_idB= $session_id
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | { | ||||||||||||||||||||||||||||||||||||||||||
| 137 | #check the session ID for remote exploitation attempts | ||||||||||||||||||||||||||||||||||||||||||
| 138 | #this will die() on suspicious session IDs. | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | #eval { &{$self->{validate}}($self); } ; | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | &{$self->{validate}}($self); | |||||||||||||||||||||||||||||||||||||||||
| 142 | #if (!$@) | ||||||||||||||||||||||||||||||||||||||||||
| 143 | { # session id is ok | ||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $self->{status} &= ($self->{status} ^ NEW); | |||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if ($self -> {'args'}{'create_unknown'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | { | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | eval { $self -> restore } ; | |||||||||||||||||||||||||||||||||||||||||
| 150 | #warn "Try to load session: $@" if ($@) ; | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $@ = "" ; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $session_id = $self->{data}->{_session_id} ; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | else | ||||||||||||||||||||||||||||||||||||||||||
| 155 | { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $self->restore; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $@ = '' ; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | if (!($self->{status} & SYNCED)) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $self->{status} |= NEW(); | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if (!$self->{data}->{_session_id} || $self -> {'args'}{'recreate_id'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->{"data"}{"_session_id"} or $self->{"args"}{"recreate_id"}
MC/DC0%0/2
not $self->{"data"}{"_session_id"} or $self->{"args"}{"recreate_id"}
not $self->{"data"}{"_session_id"}
$self->{"args"}{"recreate_id"}
Truth table0%0/3
not(A) or B
A= not $self->{"data"}{"_session_id"}B= $self->{"args"}{"recreate_id"}
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if (exists ($self->{generate})) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | { # Apache::Session >= 1.50 | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->{data}->{_session_id} = &{$self->{generate}}($self) ; | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | else | ||||||||||||||||||||||||||||||||||||||||||
| 173 | { | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $self->{data}->{_session_id} = $self -> generate_id() ; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->save; | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | else | ||||||||||||||||||||||||||||||||||||||||||
| 180 | { | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $self -> {newidpending} = $self -> {newid} ; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | #warn "Session INIT $self->{initial_session_id};$self->{data}->{_session_id};" ; | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | sub FETCH { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FETCH: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | $self -> init if (!$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return $self->{data}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub STORE { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
STORE: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | $self -> init if (!$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $self->{data}->{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $self->{status} |= MODIFIED; | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | return $self->{data}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub DELETE { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DELETE: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | $self -> init if (!$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $self->{status} |= MODIFIED; | |||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | delete $self->{data}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub CLEAR { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CLEAR: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | $self -> init if (!$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $self->{status} |= MODIFIED; | |||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | $self->{data} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | sub EXISTS { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
EXISTS: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | $self -> init if (!$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | return exists $self->{data}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | sub FIRSTKEY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
FIRSTKEY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | $self -> init if (!$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my $reset = keys %{$self->{data}}; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | return each %{$self->{data}}; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | ▶ | sub NEXTKEY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
NEXTKEY: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | $self -> init if (!$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return each %{$self->{data}}; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 2 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 2 | ▶ | $self->save if ($self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | # destroy store object to make sure all data is written and everything | ||||||||||||||||||||||||||||||||||||||||||
| 269 | # is closed before we release the locks | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 2 | $self->{object_store} = undef ; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 2 | $self->release_all_locks; | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | sub cleanup | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cleanup: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $self->{initial_session_id} = undef ; | |||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | if ($self -> {'status'}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | { | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $self->save; | |||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | # { | ||||||||||||||||||||||||||||||||||||||||||
| 284 | # local $SIG{__WARN__} = 'IGNORE' ; | ||||||||||||||||||||||||||||||||||||||||||
| 285 | # local $SIG{__DIE__} = 'IGNORE' ; | ||||||||||||||||||||||||||||||||||||||||||
| 286 | # eval { $self -> {object_store} -> close } ; # Try to close file storage | ||||||||||||||||||||||||||||||||||||||||||
| 287 | # $@ = "" ; | ||||||||||||||||||||||||||||||||||||||||||
| 288 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | # destroy store object to make sure all data is written and everything | ||||||||||||||||||||||||||||||||||||||||||
| 291 | # is closed before we release the locks | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $self->{object_store} = undef ; | |||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $self->release_all_locks; | |||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $self->{'status'} = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $self->{data} = {} ; | |||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | $self->{serialized} = undef ; | |||||||||||||||||||||||||||||||||||||||||
| 298 | # destroy lock object to make sure all locks are really released | ||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $self->{lock_manager} = undef ; | |||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub setid { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setid: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $self->{'status'} = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | $self->{data}->{_session_id} = $self->{initial_session_id} = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | sub setidfrom { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setidfrom: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->{'status'} = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $self->{data}->{_session_id} = $self->{initial_session_id} = undef ; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $self->{idfrom} = shift ; | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | sub getid { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getid: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | return $self->{data}->{_session_id} ; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | sub getids { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getids: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $init = shift; | |||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | $self -> init if ($init && !$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$init and not $self->{"status"}
MC/DC0%0/2
$init and not $self->{"status"}
$init
not $self->{"status"}
Truth table0%0/3
A and not(B)
A= $initB= not $self->{"status"}
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | if ($self -> {newidpending} && $self->{status}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"newidpending"} and $self->{"status"}
MC/DC0%0/2
$self->{"newidpending"} and $self->{"status"}
$self->{"newidpending"}
$self->{"status"}
Truth table0%0/3
A and B
A= $self->{"newidpending"}B= $self->{"status"}
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | { | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | $self->{data}->{_session_id} = &{$self->{generate}}($self) ; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $self -> {newidpending} = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $self->{status} |= NEW ; | |||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | return ($self->{initial_session_id}, $self->{data}->{_session_id}, $self->{status} & MODIFIED) ; | |||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | return if ($self->{status} & NEW); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $self->{initial_session_id} = "!DELETE" ; | |||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | $self -> init if (!$self -> {'status'}) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $self->{status} |= DELETED; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $self->save; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $self->{data} = {} ; # Throw away the data | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | ▶ | sub restore { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
restore: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | return if ($self->{status} & SYNCED); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | return if ($self->{status} & NEW); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | if (exists $self -> {'args'}->{Transaction} && $self -> {'args'}->{Transaction}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $self->{"args"}{"Transaction"} and $self->{"args"}{"Transaction"}
MC/DC0%0/2
exists $self->{"args"}{"Transaction"} and $self->{"args"}{"Transaction"}
exists $self->{"args"}{"Transaction"}
$self->{"args"}{"Transaction"}
Truth table0%0/3
A and B
A= exists $self->{"args"}{"Transaction"}B= $self->{"args"}{"Transaction"}
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | { | ||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $self->acquire_write_lock; | |||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||
| 366 | else | ||||||||||||||||||||||||||||||||||||||||||
| 367 | { | ||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | $self->acquire_read_lock; | |||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $self->{object_store}->materialize($self); | |||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | &{$self->{unserialize}}($self); | |||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $self->{status} &= ($self->{status} ^ MODIFIED); | |||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $self->{status} |= SYNCED | |||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | sub save { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | return unless ( | ||||||||||||||||||||||||||||||||||||||||||
| 383 | $self->{status} & MODIFIED || | ||||||||||||||||||||||||||||||||||||||||||
| 384 | $self->{status} & NEW || | ||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | $self->{status} & DELETED | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"status"} & 2 or $self->{"status"} & 1 or $self->{"status"} & 4
$self->{"status"} & 2 or $self->{"status"} & 1
MC/DC0%0/3
$self->{"status"} & 2 or $self->{"status"} & 1 or $self->{"status"} & 4
$self->{"status"} & 2
$self->{"status"} & 1
$self->{"status"} & 4
Truth table0%0/4
A or B or C
A= $self->{"status"} & 2B= $self->{"status"} & 1C= $self->{"status"} & 4
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ($self -> {newidpending}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | { | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $self->{data}->{_session_id} = &{$self->{generate}}($self) ; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $self -> {newidpending} = 0 ; | |||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $self->{status} |= NEW ; | |||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | $self->acquire_write_lock; | |||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | ▶ | if ($self->{status} & DELETED) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $self->{object_store}->remove($self); | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $self->{status} |= SYNCED; | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $self->{status} &= ($self->{status} ^ MODIFIED); | |||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | $self->{status} &= ($self->{status} ^ DELETED); | |||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | if ($self->{status} & NEW) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | &{$self->{serialize}}($self); | |||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | $self->{object_store}->insert($self); | |||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | $self->{status} &= ($self->{status} ^ NEW); | |||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $self->{status} |= SYNCED; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $self->{status} &= ($self->{status} ^ MODIFIED); | |||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | if ($self->{status} & MODIFIED) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | &{$self->{serialize}}($self); | |||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | $self->{object_store}->update($self); | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $self->{status} &= ($self->{status} ^ MODIFIED); | |||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | $self->{status} |= SYNCED; | |||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | # | ||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | # For Apache::Session 1.00 | ||||||||||||||||||||||||||||||||||||||||||
| 426 | # | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | sub get_object_store { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_object_store: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | return new {$self -> {'args'}{'object_store'}} $self; | |||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | sub get_lock_manager { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_lock_manager: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | return new {$self -> {'args'}{'lock_manager'}} $self; | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | # | ||||||||||||||||||||||||||||||||||||||||||
| 441 | # Default validate for Apache::Session < 1.53 | ||||||||||||||||||||||||||||||||||||||||||
| 442 | # | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | sub validate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 445 | #This routine checks to ensure that the session ID is in the form | ||||||||||||||||||||||||||||||||||||||||||
| 446 | #we expect. This must be called before we start diddling around | ||||||||||||||||||||||||||||||||||||||||||
| 447 | #in the database or the disk. | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | my $session = shift; | |||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ▶ | if ($session->{data}->{_session_id} !~ /^[a-fA-F0-9]+$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | die 'Invalid session id' ; | |||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | # | ||||||||||||||||||||||||||||||||||||||||||
| 457 | # For Apache::Session >= 1.50 | ||||||||||||||||||||||||||||||||||||||||||
| 458 | # | ||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | sub populate | ||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
populate: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my $store = $self->{args}->{Store}; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my $lock = $self->{args}->{Lock}; | |||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | if (!$self->{populated}) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | { | ||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | my $gen = $self->{args}->{Generate}; | |||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $ser = $self->{args}->{Serialize}; | |||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | $self->{object_store} = new $store $self if ($store) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | $self->{lock_manager} = new $lock $self if ($lock); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | $self->{generate} = \&{$gen . '::generate'} if ($gen); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | $self->{'validate'} = \&{$gen . '::validate'} if ($gen && defined (&{$gen . '::validate'})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$gen and defined &{$gen . '::validate';}
MC/DC0%0/2
$gen and defined &{$gen . '::validate';}
$gen
defined &{$gen . '::validate';}
Truth table0%0/3
A and B
A= $genB= defined &{$gen . '::validate';}
| |||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | ▶ | $self->{serialize} = \&{$ser . '::serialize'} if ($ser); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | $self->{unserialize} = \&{$ser . '::unserialize'} if ($ser) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | ▶ | if (!defined ($self->{'validate'})) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | { | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | $self->{'validate'} = \&validate ; | |||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | $self->{populated} = 1 ; | |||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||
| 485 | else | ||||||||||||||||||||||||||||||||||||||||||
| 486 | { # recreate only store & lock classes as far as necessary | ||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | $self->{object_store} ||= new $store $self if ($store) ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"object_store"} ||= $store->new($self)
MC/DC0%0/2
$self->{"object_store"} ||= $store->new($self)
$self->{"object_store"}
$store->new($self)
Truth table0%0/3
A ||= B
A= $self->{"object_store"}B= $store->new($self)
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | $self->{lock_manager} ||= new $lock $self if ($lock); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"lock_manager"} ||= $lock->new($self)
MC/DC0%0/2
$self->{"lock_manager"} ||= $lock->new($self)
$self->{"lock_manager"}
$lock->new($self)
Truth table0%0/3
A ||= B
A= $self->{"lock_manager"}B= $lock->new($self)
| |||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | 1 | 1 ; | |||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | __END__ | ||||||||||||||||||||||||||||||||||||||||||