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 '') { }
357 0 75 unless (exists $self->{$key})
360 61 14 if ($conf{$entry} =~ /$self->{'AutoTrueFlags'}{'true'}/io) { }
6 8 elsif ($conf{$entry} =~ /$self->{'AutoTrueFlags'}{'false'}/io) { }
372 6 54 if ($self->{'MergeDuplicateOptions'})
374 6 0 unless (exists $conf{-'AllowMultiOptions'})
379 0 60 if ($self->{'ApacheCompatible'})
392 3 57 if ($self->{'UseApacheIfDefine'})
393 3 0 if (exists $conf{-'Define'})
396 1 2 if ($ref eq '') { }
0 2 elsif ($ref eq 'SCALAR') { }
1 1 elsif ($ref eq 'ARRAY') { }
1 0 elsif ($ref eq 'HASH') { }
424 49 0 exists $this->{'config'} ? :
433 1 0 exists $this->{'files'} ? :
445 0 71 unless $cont
449 8 63 if ($basepath) { }
458 0 71 if ($^O =~ /win/i)
465 4 67 if ($this->{'IncludeGlob'} and $configfile =~ /$glob/)
472 0 4 if (not @include and defined $this->{'ConfigPath'})
475 0 0 if (-d catfile($dir, $path))
491 3 64 unless (-e $configfile)
493 0 3 if (defined $this->{'ConfigPath'})
496 0 0 if (-e catfile($dir, $basefile))
503 3 0 unless ($found)
504 0 3 defined $this->{'ConfigPath'} ? :
510 0 64 unless ($Config::General::RS)
515 1 63 if (-d $configfile and $this->{'IncludeDirectories'}) { }
0 63 elsif (-d $configfile) { }
63 0 elsif (-e _) { }
518 0 1 unless opendir INCLUDEDIR, $configfile
524 5 0 if (not exists $this->{'files'}{$file} or $this->{'IncludeAgain'}) { }
539 1 62 if (exists $this->{'files'}{$configfile} and not $this->{'IncludeAgain'}) { }
564 0 67 unless my $fh = 'IO::File'->new($file, 'r')
572 4 63 if $this->{'UTF8'} or $has_BOM
575 63 4 if $n_read and not $has_BOM
594 15 67 if ($flag and $flag eq 'SCALAR') { }
595 0 15 if (ref $fh eq 'ARRAY') { }
608 0 82 unless $cont
610 3 79 if ($this->{'UseApacheIfDefine'})
615 0 766 if ($this->{'AutoLaunder'})
616 0 0 if (/^(.*)$/)
624 25 741 if ($hier)
626 7 18 if (/^(\s*)\Q$hierend\E\s*$/) { }
630 0 7 if ($indent) { }
651 741 0 if ($this->{'CComments'})
653 2 739 if (m[(\s*/\*.*\*/\s*)]) { }
15 724 elsif (m[^\s*/\*]) { }
15 709 elsif (m[\*/]) { }
659 0 15 if (m[\*/\s*$]) { }
668 0 15 unless ($c_comment)
674 152 589 if $c_comment
679 0 589 if /^\s*#/
682 9 580 if (/(?
691 3 577 if (not $this->{'ApacheCompatible'} and m[\s*<([^/]+?.*?)/>\s*$])
693 3 0 unless ($block =~ /\"/)
694 3 0 unless ($block =~ /\s[^\s]/)
699 3 0 if ($this->{'SlashIsDirectory'})
714 507 70 if ($this->{'SplitPolicy'} eq 'guess') { }
715 2 505 if (/^\s*([^=]+?)\s*=\s*<<\s*(.+?)\s*$/) { }
5 500 elsif (/^\s*(\S+?)\s+<<\s*(.+?)\s*$/) { }
730 1 69 if (/^\s*(.+?)($this->{'SplitDelimiter'})<<\s*(.+?)\s*$/)
743 5 564 if ($longline) { }
753 131 433 if /^\s*$/
758 87 346 if ($this->{'IncludeRelative'} and defined $this->{'CurrentConfigFilePath'}) { }
0 346 elsif (defined $this->{'ConfigPath'}) { }
767 16 417 if ($this->{'UseApacheInclude'}) { }
769 1 15 if (/^\s*(include|includeoptional)\s*(["'])(.*?)(?
3 12 elsif (/^\s*(include|includeoptional)\s+(.+?)\s*$/i) { }
777 4 12 if ($incl_file)
778 2 0 if ($this->{'IncludeGlob'} and $opt =~ /opt/i and not $incl_file =~ /[*?\[\{\\]/)
793 0 417 if (/^\s*<>\\s*$/i) { }
17 400 elsif (/^\s*<>\s*$/i) { }
801 21 412 if ($incl_file) { }
802 8 13 if ($this->{'IncludeRelative'} and $path and not file_name_is_absolute($incl_file)) { }
839 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) { }
857 0 3 if ($blockLevel)
884 7 614 if (/$this->{'EOFseparator'}/) { }
888 499 115 if ($this->{'SplitPolicy'} eq 'guess') { }
899 0 621 if ($this->{'NormalizeOption'})
903 9 431 if ($value and $value =~ /^"/ and $value =~ /"$/)
907 335 286 if (not defined $block) { }
21 265 elsif (m[^<([^/]+?.*?)>$]) { }
107 158 elsif (m[^$]) { }
908 86 249 if (m[^<([^/]+?.*?)>$]) { }
0 249 elsif (m[^$]) { }
910 1 85 if ($block =~ /^"([^"]+)"$/) { }
916 85 0 if ($block =~ /^(?:"([^"]+)"|(\S+))(?:\s+(?:"([^"]+)"|(.*)))?$/)
921 0 86 if ($this->{'NormalizeBlock'})
923 0 0 if (defined $blockname)
925 0 0 if ($blockname eq '')
931 30 56 if ($this->{'InterPolateVars'})
935 12 18 if (defined $blockname)
939 0 86 if ($this->{'LowerCaseNames'})
950 0 249 if ($this->{'LowerCaseNames'})
954 25 224 if (exists $config->{$option}) { }
955 5 20 if ($this->{'MergeDuplicateOptions'}) { }
959 2 3 if ($this->{'InterPolateVars'})
965 0 20 if (not $this->{'AllowMultiOptions'}) { }
971 13 7 if (ref $config->{$option} ne 'ARRAY')
980 0 20 if ($Config::General::EVAL_ERROR) { }
991 2 222 if ($this->{'ForceArray'} and defined $value and $value =~ /^\[\s*(.+?)\s*\]$/) { }
999 72 150 if ($this->{'InterPolateVars'})
1012 21 86 if ($block_level) { }
1017 42 44 if (defined $blockname) { }
1020 30 12 unless (exists $config->{$block})
1024 9 21 if ($this->{'InterPolateVars'})
1030 1 41 if (ref $config->{$block} eq '') { }
2 39 elsif (ref $config->{$block} eq 'ARRAY') { }
0 39 elsif (exists $config->{$block}{$blockname}) { }
1040 0 0 if ($this->{'MergeDuplicateBlocks'}) { }
1046 0 0 if (not $this->{'AllowMultiOptions'}) { }
1053 0 0 if (ref $savevalue eq 'ARRAY') { }
1068 12 27 if ($this->{'InterPolateVars'})
1078 5 39 if (exists $config->{$block}) { }
1079 1 4 if (ref $config->{$block} eq '')
1085 2 2 if ($this->{'MergeDuplicateBlocks'}) { }
1091 0 2 if (not $this->{'AllowMultiOptions'}) { }
1098 0 2 if (ref $savevalue eq 'ARRAY') { }
1107 0 2 if ($this->{'InterPolateVars'})
1122 16 23 if ($this->{'InterPolateVars'})
1140 0 134 if ($block)
1173 0 249 unless $cont
1176 4 245 unless (defined $value)
1182 0 245 if ($this->{'NormalizeValue'})
1186 73 172 if ($this->{'InterPolateVars'})
1191 46 199 if ($this->{'AutoTrue'})
1192 7 39 if ($value =~ /$this->{'AutoTrueFlags'}{'true'}/io) { }
9 30 elsif ($value =~ /$this->{'AutoTrueFlags'}{'false'}/io) { }
1201 35 210 if ($this->{'FlagBits'})
1202 2 33 if (exists $this->{'FlagBitsFlags'}{$option})
1205 5 1 if (exists $__flags{$flag}) { }
1216 244 1 unless ($this->{'NoEscape'})
1230 0 728 if (exists $this->{'Plug'}{$hook})
1250 0 0 if (@two and $one and scalar(@two) % 2 == 0) { }
1270 0 7 if (not $file) { }
1274 0 7 if ($this->{'UTF8'}) { }
1276 0 0 unless open $fh, '>:utf8', $file
1280 0 7 unless $fh = 'IO::File'->new("$file", 'w')
1283 5 2 if (not $config) { }
1284 5 0 if (exists $this->{'config'}) { }
1295 6 0 if ($config_string) { }
1316 0 1 if (not $config or ref $config ne 'HASH') { }
1317 0 0 if (exists $this->{'config'}) { }
1342 15 16 $this->{'SaveSorted'} ? :
1344 1 92 if ($entry =~ /[<>\n\r]/)
1348 5 87 if (ref $config->{$entry} eq 'ARRAY') { }
21 66 elsif (ref $config->{$entry} eq 'HASH') { }
1349 1 4 if ($this->{'ForceArray'} and scalar @{$config->{$entry};} == 1 and not ref $config->{$entry}[0]) { }
1354 0 4 $this->{'SaveSorted'} ? :
1355 2 8 if (ref $line eq 'HASH') { }
1388 0 75 if (not defined $line) { }
3 72 elsif ($line =~ /\n/ or $line =~ /\\$/) { }
1397 0 3 if ($line =~ /$tmplimiter/s) { }
1414 72 0 unless ($this->{'NoEscape'})
1420 2 70 if ($line =~ /^\s/ or $line =~ /\s$/)
1440 0 23 if ($entry =~ /\s/)
1449 17 6 if ($num == 1)
1451 11 6 if (ref $line->{$key} eq 'HASH')
1472 1 153 if ($this->{'Tie'}) { }
1476 0 1 if ($Config::General::EVAL_ERROR)
1505 0 1 if (not $file && $hash) { }
1509 0 1 if (ref $hash ne 'HASH') { }
1526 0 0 if (not $hash) { }
1530 0 0 if (ref $hash ne 'HASH') { }