Branch Coverage

blib/lib/CGI/SecureState.pm
Criterion Covered Total %
branch 85 180 47.2


line true false branch
39 0 3 if /MacOS/i or /V[MO]S/i or /MSWin32/i
42 0 3 $] < 5.006 ? :
47 0 3 if /[:-]?no_nasty_warnings/
48 0 3 if /[:-]?dont_avoid_symlinks/
49 0 3 if /[:-]?no_flock/
50 0 3 if /[:-]?use_flock/
51 0 3 if (/[:-]?(extra|paranoid|no)_secure/)
53 0 0 /no_/ ? :
82 0 3 unless defined $args{'-mindSet'}
85 3 0 if (defined $args{'-mindSet'}) { }
0 0 elsif ($CGI::SecureState::NASTY_WARNINGS) { }
86 0 3 if $args{'-mindSet'} =~ /unforgetful/i
102 0 3 if (not defined $cgi->param('.id') and $cgi->request_method eq 'POST')
126 0 3 $cgi->param('.id') ? :
129 0 3 @{$args{'-memory'};} ? :
130 1 2 $newmemory || !$$cgi{'.isforgetful'} ? :
138 3 3 ref $_[1] eq 'ARRAY' ? :
146 8 5 $isforgetful ? :
154 13 7 if $isforgetful
168 1 1 if $$self{'.isforgetful'}
175 0 3 unless unlink $$self{'.statefile'}
181 0 6 unless @_
188 0 3 unless @_
189 3 0 if (@_ == 1) { }
192 0 3 unless defined $value
193 1 2 wantarray ? :
195 0 0 ref $_[1] eq 'ARRAY' ? :
202 0 1 unless @_
213 2 0 if (defined $$self{'.age'})
237 0 0 $type eq 'field' ? :
0 0 $type eq 'param' ? :
1 0 $type eq 'url' ? :
245 0 0 if ($CGI::SecureState::NASTY_WARNINGS and not defined $isforgetful)
260 0 0 unless (defined $args{'-directory'})
261 0 0 unless $$self{'.statefile'}
267 0 0 unless opendir STATEDIR, $args{'-directory'}
269 0 0 unless /^([0-9A-Za-z_-]{27})$/
277 0 0 if $CGI::SecureState::AVOID_SYMLINKS and -l $_
278 0 0 unlink($_) ? :
280 0 0 @old_states ? :
286 0 0 if (ref $$self{'.errormsg'} eq 'CODE')
287 0 0 if $$self{'.errormsg'}(@_)
293 0 0 if ($error =~ /^failed/) { }
0 0 elsif ($error eq 'symlink encountered') { }
0 0 elsif ($error eq 'invalid state file') { }
0 0 elsif ($error eq 'statefile inconsistent with mindset') { }
327 0 3 unless @_
328 3 0 $_[0] =~ /^-/ ? :
339 1 0 if ($format eq 'url') { }
0 0 elsif ($format eq 'form') { }
340 1 0 $CGI::USE_PARAM_SEMICOLONS ? :
347 0 2 if $_ eq '.id' or substr($_, 0, 4) eq '.tmp'
349 2 0 if $format eq 'url'
350 0 2 if $format eq 'form'
353 2 0 if $format eq 'url'
354 0 2 if $format eq 'form'
366 0 11 @values ? :
368 11 0 unless @values
553 0 3 $] < 5.006 ? :
0 12 if -l $statefile
12 0 if ($CGI::SecureState::AVOID_SYMLINKS)
0 12 unless sysopen STATEFILE, $statefile, 0
0 12 unless flock STATEFILE, 1
12 0 if ($CGI::SecureState::USE_FLOCK)
10 0 $length % 8 ? :
0 10 if ((stat STATEFILE)[7] != $length + $extra + 8)
0 10 unless (sysread(STATEFILE, $buffer, $length + $extra) == $length + $extra)
2 10 if (not sysread(STATEFILE, $buffer, 8) == 8) { }
0 12 unless flock STATEFILE, 8
12 0 if ($CGI::SecureState::USE_FLOCK)
0 12 unless close STATEFILE
19 2 $buffer ? :
0 21 if ($CGI::SecureState::AVOID_SYMLINKS and -l $statefile)
0 21 unless sysopen STATEFILE, $statefile, $open_flags, 384
0 21 if ($CGI::SecureState::USE_FLOCK and not flock(STATEFILE, 2))
0 2 if (sysread(STATEFILE, $buffer, 16) == 16) { }
19 0 if ($length %= 8)
2 19 if (not $buffer) { }
0 21 unless flock STATEFILE, 8
21 0 if ($CGI::SecureState::USE_FLOCK)
0 21 unless close STATEFILE
6 4 $isforgetful ? :
0 10 if ($param ne ($isforgetful ? 'Forgetful' : 'Remembering'))
0 5 if not $isforgetful and exists $$memory{$param} || defined $self->param($param)
10 5 if $isforgetful
10 2 if (@data)
8 27 if $isforgetful xor exists $$memory{$_}
6 21 if $_ eq '.id' or substr($_, 0, 4) eq '.tmp'
21 0 if (@values = $self->param($_))
11 8 $isforgetful ? :