Branch Coverage

blib/lib/Config/Simple.pm
Criterion Covered Total %
branch 145 228 63.6


line true false branch
22 0 3 if ($_ eq '-lc')
23 3 0 if ($_ eq '-strict')
52 1 11 unless $self->_init(@_)
64 1 11 if ($self->autosave and $self->_is_modified)
76 5 7 if (@_ == 1) { }
0 7 elsif (@_ % 2) { }
84 1 6 if (exists $$self{'_ARGS'}{'syntax'})
88 0 7 if (exists $$self{'_ARGS'}{'autosave'})
92 1 6 if (exists $$self{'_ARGS'}{'filename'})
103 20 1 if (defined $bool)
114 1 12 if (defined $bool)
124 1 5 if (defined $syntax)
135 0 21 unless (defined $arg)
138 2 19 if (ref $arg and ref $arg eq 'GLOB')
141 0 19 unless (defined $mode)
144 2 17 unless (sysopen FH, $arg, $mode)
158 0 11 if (defined $$self{'_FILE_HANDLE'})
161 0 11 unless (defined $file)
166 2 9 unless $$self{'_FILE_HANDLE'} = $self->_get_fh($file, 0)
168 0 9 unless $$self{'_SYNTAX'} = $self->guess_syntax(\*FH)
172 7 2 if ($$self{'_SYNTAX'} eq 'ini') { }
2 0 elsif ($$self{'_SYNTAX'} eq 'simple') { }
0 0 elsif ($$self{'_SYNTAX'} eq 'http') { }
180 9 0 if ($$self{'_DATA'})
191 0 0 unless my $fh = $$self{'_FILE_HANDLE'}
192 0 0 unless (CORE::close $fh)
208 0 9 unless (defined $fh)
209 0 0 unless $fh = $$self{'_FILE_HANDLE'}
211 0 9 unless (seek $fh, 0, 0)
222 27 9 if /^(\n|\#|;)/
225 0 9 unless /\w/
231 6 3 if /^\s*\[\s*[^\]]+\s*\]\s*$/
235 1 2 if /^\s*[^=]+\s*=\s*.*\s*$/
239 0 2 if /^\s*[\w-]+\s*:\s*.*\s*$/
243 2 0 if /^\s*[\w-]+\s+.*$/
246 9 0 if ($syntax)
262 0 8 unless my($fh, $close_fh) = $class->_get_fh($file, 0)
263 0 8 unless (flock $fh, 1)
268 0 8 unless (seek $fh, 0, 0)
279 63 172 if $line =~ /^\s*(\n|\#|;)/
280 0 172 unless $line =~ /\S/
288 30 142 if $line =~ /^\s*\[\s*([^\]]+)\s*\]$/
290 142 0 if $line =~ /^\s*([^=]*\w)\s*=\s*(.*)\s*$/
295 0 8 unless (flock $fh, 8)
299 8 0 if ($close_fh)
308 249 0 unless $Config::Simple::LC
318 0 2 unless my($fh, $close_fh) = $class->_get_fh($file, 0)
320 0 2 unless (flock $fh, 1)
325 0 2 unless (seek $fh, 0, 0)
333 8 23 if $line =~ /^(\n|\#)/
334 0 23 unless $line =~ /\S/
339 23 0 if $line =~ /^\s*([\w-]+)\s+(.*)\s*$/
344 0 2 unless (flock $fh, 8)
349 0 2 if ($close_fh)
360 0 0 unless my($fh, $close_fh) = $class->_get_fh($file, 0)
361 0 0 unless (flock $fh, 1)
366 0 0 unless (seek $fh, 0, 0)
374 0 0 if $line =~ /^(\n|\#)/
375 0 0 unless $line =~ /\S/
381 0 0 if $line =~ /^\s*([\w-]+)\s*:\s*(.*)$/
386 0 0 unless (flock $fh, 8)
390 0 0 if ($close_fh)
402 1 57 unless (@_)
408 39 18 if (@_ == 1)
420 4 0 if (defined $$args{'-name'} and defined $$args{'-value'} || defined $$args{'-values'})
425 0 14 if (defined $$args{'-name'})
430 1 2 if (defined $$args{'-block'} and defined $$args{'-values'} || defined $$args{'-value'})
433 2 11 if (defined $$args{'-block'})
437 0 11 if (@_ % 2)
442 11 0 if $self->set_param($_[$i], $_[$i + 1])
453 0 39 unless ($arg)
457 0 39 unless my $syntax = $$self{'_SYNTAX'}
462 38 1 if ($syntax eq 'ini') { }
464 37 1 if (defined $block_name and defined $key) { }
473 0 39 unless defined $rv
478 1 5 wantarray ? :
33 6 @$rv == 1 ? :
487 0 3 unless ($self->syntax eq 'ini')
490 1 2 unless (defined $block_name)
496 2 6 $$v[1] ? :
508 0 1 unless ($self->syntax eq 'ini')
514 1 3 ref $v eq 'ARRAY' ? :
529 0 15 unless my $syntax = $$self{'_SYNTAX'}
530 2 13 if (ref $value eq 'ARRAY') { }
537 13 2 unless (ref $value eq 'ARRAY')
543 12 3 if ($syntax eq 'ini')
545 11 1 if ($bn and $k)
568 0 6 unless $file ||= $$self{'_FILE_NAME'}
570 0 6 unless (sysopen FH, $file, 65, 438)
574 0 6 unless (flock FH, 2)
578 0 6 unless (truncate FH, 0)
583 0 6 unless (CORE::close FH)
602 0 6 unless my $syntax = $$self{'_SYNTAX'}
606 4 2 if ($syntax eq 'ini') { }
0 2 elsif ($syntax eq 'http') { }
2 0 elsif ($syntax eq 'simple') { }
610 10 1 unless ($sub_syntax eq 'simple-ini')
646 0 76 if (ref $string)
649 12 64 if ($Config::Simple::USEQQ and $string =~ /\W/)
663 0 1 unless my $syntax = $self->syntax
664 1 0 if ($syntax eq 'ini')
666 1 0 if (defined $bn and defined $k) { }
1324 0 8 unless my $syntax = $$self{'_SYNTAX'}
1325 7 1 if ($syntax eq 'ini') { }
1328 14 138 @{$v;} > 1 ? :
1333 1 18 @{$v;} > 1 ? :
1336 1 7 wantarray ? :
1349 2 2 unless (defined $namespace)
1352 1 1 if ($namespace eq 'Config::Simple')
1369 0 26 if (ref $class)
1373 1 1 if (defined $arg and ref $arg eq 'HASH')
1374 0 1 unless my $cfg = $class->new($file)
1379 0 1 unless (defined $arg)
1382 0 1 unless my $cfg = $class->new($file)