Branch Coverage

blib/lib/Config/General.pm
Criterion Covered Total %
branch 300 418 71.7


line true false branch
106 61 10 if ($#param >= 1) { }
9 1 elsif ($#param == 0) { }
113 0 9 if (ref $self->{'ConfigFile'} eq "HASH")
130 69 1 unless ($self->{'parsed'})
134 11 51 if ($self->{'InterPolateVars'})
151 11 58 if ($self->{'DefaultConfig'} and $self->{'InterPolateVars'})
154 14 55 if (exists $self->{'StringContent'}) { }
11 44 elsif (exists $self->{'ConfigHash'}) { }
0 44 elsif (ref $self->{'ConfigFile'} eq 'GLOB' or ref $self->{'ConfigFile'} eq 'FileHandle') { }
160 10 1 if (ref $self->{'ConfigHash'} eq 'HASH') { }
175 44 0 if ($self->{'ConfigFile'}) { }
178 0 44 if (file_name_is_absolute($self->{'ConfigFile'}))
182 0 0 unless ($self->{'ConfigPath'})
205 11 51 if ($self->{'ExtendedAccess'})
212 0 11 if ($Config::General::EVAL_ERROR)
223 11 59 if ($self->{'InterPolateVars'} or $self->{'InterPolateEnv'})
233 0 11 if ($Config::General::EVAL_ERROR)
246 2 68 if ($self->{'SplitPolicy'} ne 'guess') { }
247 0 2 if ($self->{'SplitPolicy'} eq 'whitespace') { }
0 2 elsif ($self->{'SplitPolicy'} eq 'equalsign') { }
2 0 elsif ($self->{'SplitPolicy'} eq 'custom') { }
249 0 0 if (not $self->{'StoreDelimiter'})
255 0 0 if (not $self->{'StoreDelimiter'})
260 0 2 if (not $self->{'SplitDelimiter'})
269 68 0 if (not $self->{'StoreDelimiter'})
285 6 55 if (exists $conf{'-file'})
288 0 61 if (exists $conf{'-hash'})
293 29 32 if (exists $conf{'-ConfigFile'})
296 11 50 if (exists $conf{'-ConfigHash'})
301 0 61 if (exists $conf{'-ConfigPath'})
303 0 0 ref $configpath eq 'ARRAY' ? :
307 15 46 if (exists $conf{'-String'})
308 13 2 if (not ref $conf{'-String'}) { }
1 1 elsif (ref $conf{'-String'} eq 'ARRAY') { }
309 13 0 if ($conf{'-String'})
325 1 59 if (exists $conf{'-Tie'})
326 1 0 if ($conf{'-Tie'})
332 2 58 if (exists $conf{'-FlagBits'})
333 2 0 if ($conf{'-FlagBits'} and ref $conf{'-FlagBits'} eq "HASH")
340 3 57 if (exists $conf{'-DefaultConfig'})
341 2 1 if ($conf{'-DefaultConfig'} and ref $conf{'-DefaultConfig'} eq 'HASH') { }
1 0 elsif ($conf{'-DefaultConfig'} and ref $conf{'-DefaultConfig'} eq '') { }
358 0 75 unless (exists $self->{$key})
361 61 14 if ($conf{$entry} =~ /$self->{'AutoTrueFlags'}{'true'}/io) { }
6 8 elsif ($conf{$entry} =~ /$self->{'AutoTrueFlags'}{'false'}/io) { }
373 6 54 if ($self->{'MergeDuplicateOptions'})
375 6 0 unless (exists $conf{'-AllowMultiOptions'})
380 0 60 if ($self->{'ApacheCompatible'})
393 3 57 if ($self->{'UseApacheIfDefine'})
394 3 0 if (exists $conf{'-Define'})
397 1 2 if ($ref eq '') { }
0 2 elsif ($ref eq 'SCALAR') { }
1 1 elsif ($ref eq 'ARRAY') { }
1 0 elsif ($ref eq 'HASH') { }
425 49 0 exists $this->{'config'} ? :
434 1 0 exists $this->{'files'} ? :
446 0 71 unless $cont
450 8 63 if ($basepath) { }
459 0 71 if ($^O =~ /win/i)
466 4 67 if ($this->{'IncludeGlob'} and $configfile =~ /$glob/)
473 0 4 if (not @include and defined $this->{'ConfigPath'})
476 0 0 if (-d catfile($dir, $path))
492 3 64 unless (-e $configfile)
494 0 3 if (defined $this->{'ConfigPath'})
497 0 0 if (-e catfile($dir, $basefile))
504 3 0 unless ($found)
505 0 3 defined $this->{'ConfigPath'} ? :
511 0 64 unless ($Config::General::RS)
516 1 63 if (-d $configfile and $this->{'IncludeDirectories'}) { }
0 63 elsif (-d $configfile) { }
63 0 elsif (-e _) { }
519 0 1 unless opendir INCLUDEDIR, $configfile
525 5 0 if (not exists $this->{'files'}{$file} or $this->{'IncludeAgain'}) { }
540 1 62 if (exists $this->{'files'}{$configfile} and not $this->{'IncludeAgain'}) { }
565 0 67 unless my $fh = "IO::File"->new($file, "r")
573 4 63 if $this->{'UTF8'} or $has_BOM
576 63 4 if $n_read and not $has_BOM
595 15 67 if ($flag and $flag eq 'SCALAR') { }
596 0 15 if (ref $fh eq 'ARRAY') { }
609 0 82 unless $cont
611 3 79 if ($this->{'UseApacheIfDefine'})
616 0 766 if ($this->{'AutoLaunder'})
617 0 0 if (/^(.*)$/)
625 25 741 if ($hier)
627 7 18 if (/^(\s*)\Q$hierend\E\s*$/) { }
631 0 7 if ($indent) { }
652 741 0 if ($this->{'CComments'})
654 2 739 if (m[(\s*/\*.*\*/\s*)]) { }
15 724 elsif (m[^\s*/\*]) { }
15 709 elsif (m[\*/]) { }
660 0 15 if (m[\*/\s*$]) { }
669 0 15 unless ($c_comment)
675 152 589 if $c_comment
680 0 589 if /^\s*#/
683 9 580 if (/(?
692 3 577 if (not $this->{'ApacheCompatible'} and m[\s*<([^/]+?.*?)/>\s*$])
694 3 0 unless ($block =~ /\"/)
695 3 0 unless ($block =~ /\s[^\s]/)
700 3 0 if ($this->{'SlashIsDirectory'})
715 507 70 if ($this->{'SplitPolicy'} eq 'guess') { }
716 2 505 if (/^\s*([^=]+?)\s*=\s*<<\s*(.+?)\s*$/) { }
5 500 elsif (/^\s*(\S+?)\s+<<\s*(.+?)\s*$/) { }
731 1 69 if (/^\s*(.+?)($this->{'SplitDelimiter'})<<\s*(.+?)\s*$/)
744 5 564 if ($longline) { }
754 131 433 if /^\s*$/
759 87 346 if ($this->{'IncludeRelative'} and defined $this->{'CurrentConfigFilePath'}) { }
0 346 elsif (defined $this->{'ConfigPath'}) { }
768 16 417 if ($this->{'UseApacheInclude'}) { }
770 1 15 if (/^\s*(include|includeoptional)\s*(["'])(.*?)(?
3 12 elsif (/^\s*(include|includeoptional)\s+(.+?)\s*$/i) { }
778 4 12 if ($incl_file)
779 2 0 if ($this->{'IncludeGlob'} and $opt =~ /opt/i and not $incl_file =~ /[*?\[\{\\]/)
794 0 417 if (/^\s*<>\\s*$/i) { }
17 400 elsif (/^\s*<>\s*$/i) { }
802 21 412 if ($incl_file) { }
803 8 13 if ($this->{'IncludeRelative'} and $path and not file_name_is_absolute($incl_file)) { }
840 3 6 if (/^<\s*IfDefine\s+([!]*)("[^"]+"|\S+)\s*>/i) { }
3 3 elsif (m[^<\s*/IfDefine\s*>]i) { }
0 3 elsif ($includeFlag and /\s*Define\s+("[^"]+"|\S+)/i) { }
3 0 elsif ($includeFlag) { }
858 0 3 if ($blockLevel)
885 7 614 if (/$this->{'EOFseparator'}/) { }
889 499 115 if ($this->{'SplitPolicy'} eq 'guess') { }
900 0 621 if ($this->{'NormalizeOption'})
904 9 431 if ($value and $value =~ /^"/ and $value =~ /"$/)
908 335 286 if (not defined $block) { }
21 265 elsif (m[^<([^/]+?.*?)>$]) { }
107 158 elsif (m[^$]) { }
909 86 249 if (m[^<([^/]+?.*?)>$]) { }
0 249 elsif (m[^$]) { }
911 1 85 if ($block =~ /^"([^"]+)"$/) { }
917 85 0 if ($block =~ /^(?:"([^"]+)"|(\S+))(?:\s+(?:"([^"]+)"|(.*)))?$/)
922 0 86 if ($this->{'NormalizeBlock'})
924 0 0 if (defined $blockname)
926 0 0 if ($blockname eq "")
932 30 56 if ($this->{'InterPolateVars'})
936 12 18 if (defined $blockname)
940 0 86 if ($this->{'LowerCaseNames'})
951 0 249 if ($this->{'LowerCaseNames'})
955 25 224 if (exists $config->{$option}) { }
956 5 20 if ($this->{'MergeDuplicateOptions'}) { }
960 2 3 if ($this->{'InterPolateVars'})
966 0 20 if (not $this->{'AllowMultiOptions'}) { }
972 13 7 if (ref $config->{$option} ne "ARRAY")
981 0 20 if ($Config::General::EVAL_ERROR) { }
992 2 222 if ($this->{'ForceArray'} and defined $value and $value =~ /^\[\s*(.+?)\s*\]$/) { }
1000 72 150 if ($this->{'InterPolateVars'})
1013 21 86 if ($block_level) { }
1018 42 44 if (defined $blockname) { }
1021 30 12 unless (exists $config->{$block})
1025 9 21 if ($this->{'InterPolateVars'})
1031 1 41 if (ref $config->{$block} eq '') { }
2 39 elsif (ref $config->{$block} eq 'ARRAY') { }
0 39 elsif (exists $config->{$block}{$blockname}) { }
1041 0 0 if ($this->{'MergeDuplicateBlocks'}) { }
1047 0 0 if (not $this->{'AllowMultiOptions'}) { }
1054 0 0 if (ref $savevalue eq 'ARRAY') { }
1069 12 27 if ($this->{'InterPolateVars'})
1079 5 39 if (exists $config->{$block}) { }
1080 1 4 if (ref $config->{$block} eq "")
1086 2 2 if ($this->{'MergeDuplicateBlocks'}) { }
1092 0 2 if (not $this->{'AllowMultiOptions'}) { }
1099 0 2 if (ref $savevalue eq 'ARRAY') { }
1108 0 2 if ($this->{'InterPolateVars'})
1123 16 23 if ($this->{'InterPolateVars'})
1141 0 134 if ($block)
1174 0 249 unless $cont
1177 4 245 unless (defined $value)
1183 0 245 if ($this->{'NormalizeValue'})
1187 73 172 if ($this->{'InterPolateVars'})
1192 46 199 if ($this->{'AutoTrue'})
1193 7 39 if ($value =~ /$this->{'AutoTrueFlags'}{'true'}/io) { }
9 30 elsif ($value =~ /$this->{'AutoTrueFlags'}{'false'}/io) { }
1202 35 210 if ($this->{'FlagBits'})
1203 2 33 if (exists $this->{'FlagBitsFlags'}{$option})
1206 5 1 if (exists $__flags{$flag}) { }
1217 244 1 unless ($this->{'NoEscape'})
1231 0 728 if (exists $this->{'Plug'}{$hook})
1251 0 0 if (@two and $one and scalar(@two) % 2 == 0) { }
1271 0 7 if (not $file) { }
1275 0 7 if ($this->{'UTF8'}) { }
1277 0 0 unless open $fh, ">:utf8", $file
1281 0 7 unless $fh = "IO::File"->new("$file", "w")
1284 5 2 if (not $config) { }
1285 5 0 if (exists $this->{'config'}) { }
1296 6 0 if ($config_string) { }
1317 0 1 if (not $config or ref $config ne 'HASH') { }
1318 0 0 if (exists $this->{'config'}) { }
1343 15 16 $this->{'SaveSorted'} ? :
1345 1 92 if ($entry =~ /[<>\n\r]/)
1349 5 87 if (ref $config->{$entry} eq 'ARRAY') { }
21 66 elsif (ref $config->{$entry} eq 'HASH') { }
1350 1 4 if ($this->{'ForceArray'} and scalar @{$config->{$entry};} == 1 and not ref $config->{$entry}[0]) { }
1355 0 4 $this->{'SaveSorted'} ? :
1356 2 8 if (ref $line eq 'HASH') { }
1389 0 75 if (not defined $line) { }
3 72 elsif ($line =~ /\n/ or $line =~ /\\$/) { }
1398 0 3 if ($line =~ /$tmplimiter/s) { }
1415 72 0 unless ($this->{'NoEscape'})
1421 2 70 if ($line =~ /^\s/ or $line =~ /\s$/)
1441 0 23 if ($entry =~ /\s/)
1450 17 6 if ($num == 1)
1452 11 6 if (ref $line->{$key} eq "HASH")
1473 1 153 if ($this->{'Tie'}) { }
1477 0 1 if ($Config::General::EVAL_ERROR)
1506 0 1 if (not $file && $hash) { }
1510 0 1 if (ref $hash ne 'HASH') { }
1527 0 0 if (not $hash) { }
1531 0 0 if (ref $hash ne 'HASH') { }