Branch Coverage

blib/lib/Config/IniFiles.pm
Criterion Covered Total %
branch 301 398 75.6


line true false branch
26 96 4749 if (@_)
28 10 86 shift @_ ? :
60 9 77 if (ref $parms{'-import'} and $parms{'-import'}->isa('Config::IniFiles')) { }
0 77 elsif (defined $parms{'-import'}) { }
82 69 17 if (defined($v = delete $parms{'-file'}))
88 10 76 if (defined($v = delete $parms{'-nocase'}))
92 7 79 if (defined($v = delete $parms{'-default'}))
94 7 0 $self->_nocase ? :
96 1 85 if (defined($v = delete $parms{'-fallback'}))
98 0 1 $self->_nocase ? :
100 0 86 if (defined($v = delete $parms{'-reloadwarn'}))
102 0 0 $v ? :
104 1 85 if (defined($v = delete $parms{'-nomultiline'}))
106 1 0 $v ? :
108 1 85 if (defined($v = delete $parms{'-allowcontinue'}))
110 1 0 $v ? :
112 11 75 if (defined($v = delete $parms{'-allowempty'}))
114 11 0 $v ? :
116 0 86 if (defined($v = delete $parms{'-negativedeltas'}))
118 0 0 $v ? :
120 2 84 if (defined($v = delete $parms{'-commentchar'}))
122 0 2 if (not defined $v or length $v != 1) { }
0 2 elsif ($v =~ /[\[\]=\w]/) { }
138 2 84 if (defined($v = delete $parms{'-allowedcommentchars'}))
141 0 2 if (not defined $v or $v =~ /[\[\]=\w]/) { }
152 4 82 if (defined($v = delete $parms{'-handle_trailing_comment'}))
154 3 1 $v ? :
156 1 85 if (defined($v = delete $parms{'-php_compat'}))
158 1 0 $v ? :
161 84 2 unless exists $self->{'comment_char'}
163 84 2 unless exists $self->{'allowed_comment_char'}
177 0 86 if $errs
179 81 5 if ($self->ReadConfig) { }
194 1348 3393 if ($self->_nocase)
202 27 4714 if ($self->{'php_compat'})
210 2 2 if (length ${$ref;} >= 2)
213 2 0 if ($quote eq '"' || $quote eq q['] and substr(${$ref;}, -1, 1) eq $quote)
218 1 1 if $quote eq '"'
232 0 107 unless (defined $sect and defined $parm)
242 95 12 defined $self->{'v'}{$sect}{$parm} ? :
247 7 100 unless (defined $val)
253 34 73 if (wantarray) { }
5 68 elsif (ref $val eq 'ARRAY') { }
255 12 22 if (ref $val eq 'ARRAY') { }
20 2 elsif (defined $val) { }
270 5 0 defined $/ ? :
293 0 92 unless defined $sect
294 0 92 unless defined $parm
298 0 92 unless defined $self->{'v'}{$sect}{$parm}
300 0 92 unless @vals
305 56 36 unless defined $self->{'EOT'}{$sect}{$parm}
308 56 36 unless ref $self->{'v'}{$sect}{$parm} eq 'ARRAY'
322 0 1 unless defined $sect
323 0 1 unless defined $parm
327 0 1 if (defined $self->{'v'}{$sect}{$parm}) { }
330 0 0 if (@val > 1) { }
355 0 638 unless defined $sect
356 0 638 unless defined $parm
362 611 27 if (&none(sub { $_ eq $parm; } , @{$$self{'parms'}{$sect};}))
368 112 526 if (@val > 1) { }
371 105 7 unless (defined $self->{'EOT'}{$sect}{$parm})
390 0 6 unless defined $sect
391 0 6 unless defined $parm
410 206 205 unless (ref $ref)
415 64 141 if (UNIVERSAL::isa($ref, 'ARRAY'))
420 141 0 if (UNIVERSAL::isa($ref, 'HASH'))
438 83 1978 if (not exists $self->{'line_ends'}) { }
448 12 1103 unless defined $nextchar
452 4 67 if ($nextchar eq "\r")
456 3 1 if ($nextchar eq "\n") { }
489 71 12 if (not ref $self->{'cf'}) { }
491 0 71 unless close $fh
513 2063 2115 if (@_)
528 81 1980 unless (defined $line)
555 418 5165 if (@_)
568 773 2995 if (@_)
589 806 1281 if (@_)
601 1106 1220 if (@_)
613 1252 689 if (@_)
628 2 118 if ($self->{'negativedeltas'} and my($to_delete) = $line =~ /\A$self->{'comment_char'} (.*) is deleted\z/) { }
632 1 1 if (my($sect) = $to_delete =~ /\A\[(.*)\]\z/) { }
667 1 691 if (not defined $self->_curr_sect and defined $self->{'fallback'})
681 92 597 if (exists $self->{'v'}{$self->_curr_sect}{$self->_curr_parm} and exists $self->{'myparms'}{$self->_curr_sect} and $self->_is_parm_in_sect($self->_curr_loc)) { }
703 2 690 unless (defined $self->_curr_sect)
727 129 369 if ($line eq $eotmark) { }
740 1 129 unless ($foundeot)
764 4 556 if ($end_commenthandle and my($value_to_assign, $end_comment_to_assign) = $self->_curr_val =~ /(.*?)\s*[$allCmt]\s*(.*)$/) { }
789 129 560 if (defined $eotmark)
810 2 690 unless (defined $self->_test_for_fallback_or_no_sect($fh))
821 130 560 if (($eotmark) = $self->_curr_val =~ /\A<<(.*)$/) { }
823 1 129 unless (defined $self->_ReadConfig_handle_here_doc_param($fh, $eotmark, \@val))
852 331 1149 if ($line =~ /\A\s*\z/)
858 120 1029 if ($line =~ /\A\s*[$allCmt]/)
864 334 695 if (my($sect) = $line =~ /\A\s*\[\s*(\S|\S.*\S)\s*\]\s*\z/)
870 692 3 if (my($parm, $value_to_assign) = $line =~ /^\s*([^=]*?[^=\s])\s*=\s*(.*)$/)
899 3 1477 unless (defined scalar $self->_ReadConfig_handle_line($fh, $line))
932 13 87 if (defined $self->{'imported'})
940 17 83 if ($self->_no_filename)
946 0 83 if ($self->{'reloadwarn'})
956 0 83 unless ($fh)
964 79 4 if (ref $fh ne 'IO::Scalar' and -e $fh)
966 66 13 unless (exists $self->{'file_mode'})
969 66 0 if defined $stats[2]
981 3 80 unless (defined $self->_ReadConfig_lines_loop($fh))
988 1 4 unless (keys %{$$self{'v'};} or $self->{'allowempty'})
995 11 68 if (defined(my $defaultsect = $self->{'startup_settings'}{'-default'}))
1003 1 78 @Config::IniFiles::errors ? :
1020 0 995 unless defined $sect
1024 639 356 exists $self->{'e'}{$sect} ? :
1040 354 1 unless (defined $self->{'v'}{$sect})
1055 0 989 unless defined $sect
1059 636 353 if ($self->SectionExists($sect))
1074 364 1528 unless (exists $self->{'mye'}{$sect})
1089 0 1458 unless exists $self->{'v'}{$sect}
1092 637 821 unless ($self->_is_parm_in_sect($sect, $parm))
1106 0 7 unless defined $sect
1135 0 1 unless $self->CopySection($old_sect, $new_sect, $include_groupmembers)
1149 0 2 if (not defined $old_sect && defined $new_sect && $self->SectionExists($old_sect) or $self->SectionExists($new_sect))
1163 3 11 unless exists $self->{$key}{$old_sect}
1168 0 2 if ($include_groupmembers)
1186 28 4 defined $aref && ref $aref eq 'ARRAY' ? :
1194 0 22 unless defined $sect
1206 2 0 if (ref $self->{'group'} eq 'HASH') { }
1221 0 362 unless defined $sect
1223 235 127 if (not my($group) = $sect =~ /\A(\S+)\s+\S/) { }
1237 69 58 unless (exists $self->{'group'}{$group})
1242 127 0 if (&none(sub { $_ eq $sect; } , @{$$self{'group'}{$group};}))
1263 0 0 unless (exists $self->{'group'}{$group})
1287 0 6 unless defined $group
1299 0 5 unless (defined $mode and $mode =~ /[0-7]{3}/)
1320 7 16 if (-e $filename)
1322 0 7 unless (-w $filename)
1327 1 6 unless (exists $self->{'file_mode'})
1351 0 23 if ($^O =~ /\AMSWin/)
1357 0 23 if ($@)
1364 0 23 unless close $fh
1365 0 23 unless (rename $new_file, $filename)
1370 19 4 if (exists $self->{'file_mode'})
1372 0 19 unless (chmod oct $self->{'file_mode'}, $filename)
1386 0 3 if ($fh == \*STDIN) { }
1415 0 3 unless ($fh)
1428 0 26 unless defined $file
1432 23 3 if (not ref $file) { }
1450 0 16 if ($self->_no_filename)
1471 12 0 if (length $new_filename > 0) { }
1510 1 201 $end_comment ? :
1517 10 202 if (not @$val) { }
137 65 elsif (@$val == 1 or $self->{'nomultiline'}) { }
1550 167 203 if (ref $comments_aref eq 'ARRAY')
1565 533 27 unless ($self->{'allowcontinue'})
1585 1 212 unless (defined $self->{'v'}{$sect}{$parm})
1587 1 0 if ($delta) { }
1593 0 0 if $^W
1603 0 212 unless defined $val
1605 153 59 defined $end_comment ? :
1615 1 131 unless (defined $self->{'v'}{$sect})
1617 1 0 if ($delta) { }
1623 0 0 if $^W
1627 0 131 unless defined $self->{'v'}{$sect}
1628 106 25 if $position > 0
1631 130 1 unless ($self->{'fallback_used'} and $sect eq $self->{'fallback'})
1635 0 131 if ref $self->{'v'}{$sect} ne 'HASH'
1637 7 124 $delta ? :
1658 0 749 unless print {$fh;} @_, $ors
1667 64 148 ref $val eq 'ARRAY' ? :
1675 3 24 $delta ? :
1691 266 70 unless (defined $sect and @comment)
1719 110 7 $_ =~ /$is_comment/ ? :
1727 9 0 defined $/ ? :
1729 6 3 wantarray ? :
1736 0 8 unless defined $sect
1740 3 5 unless (exists $self->{'sCMT'}{$sect})
1754 0 2 unless defined $sect
1769 659 31 unless (defined $sect and defined $parm and @comment)
1807 0 4 unless (defined $sect and defined $parm)
1814 0 4 unless (exists $self->{'pCMT'}{$sect} and exists $self->{'pCMT'}{$sect}{$parm})
1830 0 1 unless (defined $sect and defined $parm)
1838 1 0 if (exists $self->{'pCMT'}{$sect} and exists $self->{'pCMT'}{$sect}{$parm})
1853 0 0 unless (defined $sect and defined $parm)
1868 0 129 unless (defined $sect and defined $parm and defined $EOT)
1887 0 0 unless (defined $sect and defined $parm)
1905 129 561 unless (defined $sect and defined $parm and defined $cmt)
1913 0 561 unless exists $self->{'v'}{$sect}{$parm}
1926 0 5 unless (defined $sect and defined $parm)
1934 0 5 unless exists $self->{'v'}{$sect}{$parm}
1995 1 32 unless $self->{'v'}{$key}
1998 21 11 if exists $self->{'_section_cache'}{$key}
2018 0 4 unless ref $ref eq 'HASH'
2084 1 10 unless defined $key
2085 0 10 wantarray ? :
2140 3 83 if (ref $thing eq 'SCALAR')
2142 3 0 if (eval { do { require IO::Scalar; $IO::Scalar::VERSION >= 2.109 } }) { }
2148 0 0 if $^W
2155 13 70 if defined fileno $thing
2159 0 70 if defined fileno $fh
2163 0 70 unless open $fh, $thing
2242 18 4 @retval <= 1 ? :
2356 3 10 unless defined $key
2357 0 10 wantarray ? :