Branch Coverage

blib/lib/Config/General.pm
Criterion Covered Total %
branch 303 420 72.1


line true false branch
106 62 10 if ($#param >= 1) { }
9 1 elsif ($#param == 0) { }
113 0 9 if (ref $self->{'ConfigFile'} eq "HASH")
130 70 1 unless ($self->{'parsed'})
134 11 52 if ($self->{'InterPolateVars'})
151 11 59 if ($self->{'DefaultConfig'} and $self->{'InterPolateVars'})
154 14 56 if (exists $self->{'StringContent'}) { }
11 45 elsif (exists $self->{'ConfigHash'}) { }
0 45 elsif (ref $self->{'ConfigFile'} eq 'GLOB' or ref $self->{'ConfigFile'} eq 'FileHandle') { }
160 10 1 if (ref $self->{'ConfigHash'} eq 'HASH') { }
175 45 0 if ($self->{'ConfigFile'}) { }
178 0 45 if (file_name_is_absolute($self->{'ConfigFile'}))
182 0 0 unless ($self->{'ConfigPath'})
205 11 52 if ($self->{'ExtendedAccess'})
212 0 11 if ($Config::General::EVAL_ERROR)
223 11 60 if ($self->{'InterPolateVars'} or $self->{'InterPolateEnv'})
233 0 11 if ($Config::General::EVAL_ERROR)
246 2 69 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 69 0 if (not $self->{'StoreDelimiter'})
285 6 56 if (exists $conf{'-file'})
288 0 62 if (exists $conf{'-hash'})
293 30 32 if (exists $conf{'-ConfigFile'})
296 11 51 if (exists $conf{'-ConfigHash'})
301 0 62 if (exists $conf{'-ConfigPath'})
303 0 0 ref $configpath eq 'ARRAY' ? :
307 15 47 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 60 if (exists $conf{'-Tie'})
326 1 0 if ($conf{'-Tie'})
332 2 59 if (exists $conf{'-FlagBits'})
333 2 0 if ($conf{'-FlagBits'} and ref $conf{'-FlagBits'} eq "HASH")
340 3 58 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 76 unless (exists $self->{$key})
361 62 14 if ($conf{$entry} =~ /$self->{'AutoTrueFlags'}{'true'}/io) { }
6 8 elsif ($conf{$entry} =~ /$self->{'AutoTrueFlags'}{'false'}/io) { }
373 6 55 if ($self->{'MergeDuplicateOptions'})
375 6 0 unless (exists $conf{'-AllowMultiOptions'})
380 0 61 if ($self->{'ApacheCompatible'})
393 3 58 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 72 unless $cont
450 8 64 if ($basepath) { }
459 0 72 if ($^O =~ /win/i)
466 4 68 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 65 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 65 unless ($Config::General::RS)
516 1 64 if (-d $configfile and $this->{'IncludeDirectories'}) { }
0 64 elsif (-d $configfile) { }
64 0 elsif (-e _) { }
519 0 1 unless opendir INCLUDEDIR, $configfile
527 5 0 if (not exists $this->{'files'}{$file} or $this->{'IncludeAgain'}) { }
542 1 63 if (exists $this->{'files'}{$configfile} and not $this->{'IncludeAgain'}) { }
567 0 68 unless my $fh = "IO::File"->new($file, "r")
575 4 64 if $this->{'UTF8'} or $has_BOM
578 64 4 if $n_read and not $has_BOM
597 15 68 if ($flag and $flag eq 'SCALAR') { }
598 0 15 if (ref $fh eq 'ARRAY') { }
611 0 83 unless $cont
613 3 80 if ($this->{'UseApacheIfDefine'})
618 0 767 if ($this->{'AutoLaunder'})
619 0 0 if (/^(.*)$/)
627 25 742 if ($hier)
629 7 18 if (/^(\s*)\Q$hierend\E\s*$/) { }
633 0 7 if ($indent) { }
654 742 0 if ($this->{'CComments'})
656 2 740 if (m[(\s*/\*.*\*/\s*)]) { }
15 725 elsif (m[^\s*/\*]) { }
15 710 elsif (m[\*/]) { }
662 0 15 if (m[\*/\s*$]) { }
671 0 15 unless ($c_comment)
677 152 590 if $c_comment
682 0 590 if /^\s*#/
685 9 581 if (/(?
694 3 578 if (not $this->{'ApacheCompatible'} and m[\s*<([^/]+?.*?)/>\s*$])
696 3 0 unless ($block =~ /\"/)
697 3 0 unless ($block =~ /\s[^\s]/)
702 3 0 if ($this->{'SlashIsDirectory'})
717 508 70 if ($this->{'SplitPolicy'} eq 'guess') { }
718 2 506 if (/^\s*([^=]+?)\s*=\s*<<\s*(.+?)\s*$/) { }
5 501 elsif (/^\s*(\S+?)\s+<<\s*(.+?)\s*$/) { }
733 1 69 if (/^\s*(.+?)($this->{'SplitDelimiter'})<<\s*(.+?)\s*$/)
746 5 565 if ($longline) { }
756 131 434 if /^\s*$/
761 87 347 if ($this->{'IncludeRelative'} and defined $this->{'CurrentConfigFilePath'}) { }
0 347 elsif (defined $this->{'ConfigPath'}) { }
770 16 418 if ($this->{'UseApacheInclude'}) { }
772 1 15 if (/^\s*(include|includeoptional)\s*(["'])(.*?)(?
3 12 elsif (/^\s*(include|includeoptional)\s+(.+?)\s*$/i) { }
780 4 12 if ($incl_file)
781 2 0 if ($this->{'IncludeGlob'} and $opt =~ /opt/i and not $incl_file =~ /[*?\[\{\\]/)
796 0 418 if (/^\s*<>\\s*$/i) { }
17 401 elsif (/^\s*<>\s*$/i) { }
804 21 413 if ($incl_file) { }
805 8 13 if ($this->{'IncludeRelative'} and $path and not file_name_is_absolute($incl_file)) { }
841 3 6 if (/^\s*<\s*IfDefine\s+([!]*)("[^"]+"|\S+)\s*>/i) { }
3 3 elsif (m[^\s*<\s*/IfDefine\s*>]i) { }
0 3 elsif ($includeFlag[-1] and /^\s*Define\s+("[^"]+"|\S+)/i) { }
3 0 elsif ($includeFlag[-1]) { }
852 0 3 if (scalar @includeFlag <= 1)
866 0 3 if (scalar @includeFlag > 1)
893 7 615 if (/$this->{'EOFseparator'}/) { }
897 500 115 if ($this->{'SplitPolicy'} eq 'guess') { }
908 0 622 if ($this->{'NormalizeOption'})
912 10 431 if ($value and $value =~ /^"/ and $value =~ /"$/)
916 336 286 if (not defined $block) { }
21 265 elsif (m[^<([^/]+?.*?)>$]) { }
107 158 elsif (m[^$]) { }
917 86 250 if (m[^<([^/]+?.*?)>$]) { }
0 250 elsif (m[^$]) { }
919 1 85 if ($block =~ /^"([^"]+)"$/) { }
925 85 0 if ($block =~ /^(?:"([^"]+)"|(\S+))(?:\s+(?:"([^"]+)"|(.*)))?$/)
930 0 86 if ($this->{'NormalizeBlock'})
932 0 0 if (defined $blockname)
934 0 0 if ($blockname eq "")
940 30 56 if ($this->{'InterPolateVars'})
944 12 18 if (defined $blockname)
948 0 86 if ($this->{'LowerCaseNames'})
959 0 250 if ($this->{'LowerCaseNames'})
963 25 225 if (exists $config->{$option}) { }
964 5 20 if ($this->{'MergeDuplicateOptions'}) { }
968 2 3 if ($this->{'InterPolateVars'})
974 0 20 if (not $this->{'AllowMultiOptions'}) { }
980 13 7 if (ref $config->{$option} ne "ARRAY")
989 0 20 if ($Config::General::EVAL_ERROR) { }
1000 2 223 if ($this->{'ForceArray'} and defined $value and $value =~ /^\[\s*(.+?)\s*\]$/) { }
1008 72 151 if ($this->{'InterPolateVars'})
1021 21 86 if ($block_level) { }
1026 42 44 if (defined $blockname) { }
1029 30 12 unless (exists $config->{$block})
1033 9 21 if ($this->{'InterPolateVars'})
1039 1 41 if (ref $config->{$block} eq '') { }
2 39 elsif (ref $config->{$block} eq 'ARRAY') { }
0 39 elsif (exists $config->{$block}{$blockname}) { }
1049 0 0 if ($this->{'MergeDuplicateBlocks'}) { }
1055 0 0 if (not $this->{'AllowMultiOptions'}) { }
1062 0 0 if (ref $savevalue eq 'ARRAY') { }
1077 12 27 if ($this->{'InterPolateVars'})
1087 5 39 if (exists $config->{$block}) { }
1088 1 4 if (ref $config->{$block} eq "")
1094 2 2 if ($this->{'MergeDuplicateBlocks'}) { }
1100 0 2 if (not $this->{'AllowMultiOptions'}) { }
1107 0 2 if (ref $savevalue eq 'ARRAY') { }
1116 0 2 if ($this->{'InterPolateVars'})
1131 16 23 if ($this->{'InterPolateVars'})
1149 0 135 if ($block)
1182 0 250 unless $cont
1185 4 246 unless (defined $value)
1191 0 246 if ($this->{'NormalizeValue'})
1195 73 173 if ($this->{'InterPolateVars'})
1200 46 200 if ($this->{'AutoTrue'})
1201 7 39 if ($value =~ /$this->{'AutoTrueFlags'}{'true'}/io) { }
9 30 elsif ($value =~ /$this->{'AutoTrueFlags'}{'false'}/io) { }
1210 35 211 if ($this->{'FlagBits'})
1211 2 33 if (exists $this->{'FlagBitsFlags'}{$option})
1214 5 1 if (exists $__flags{$flag}) { }
1225 245 1 unless ($this->{'NoEscape'})
1239 0 733 if (exists $this->{'Plug'}{$hook})
1259 0 0 if (@two and $one and scalar(@two) % 2 == 0) { }
1279 0 7 if (not $file) { }
1283 0 7 if ($this->{'UTF8'}) { }
1285 0 0 unless open $fh, ">:utf8", $file
1289 0 7 unless $fh = "IO::File"->new("$file", "w")
1292 5 2 if (not $config) { }
1293 5 0 if (exists $this->{'config'}) { }
1304 6 0 if ($config_string) { }
1325 1 1 if (not $config or ref $config ne 'HASH') { }
1326 1 0 if (exists $this->{'config'}) { }
1351 15 17 $this->{'SaveSorted'} ? :
1353 1 93 if ($entry =~ /[<>\n\r]/)
1357 5 88 if (ref $config->{$entry} eq 'ARRAY') { }
21 67 elsif (ref $config->{$entry} eq 'HASH') { }
1358 1 4 if ($this->{'ForceArray'} and scalar @{$config->{$entry};} == 1 and not ref $config->{$entry}[0]) { }
1363 0 4 $this->{'SaveSorted'} ? :
1364 2 8 if (ref $line eq 'HASH') { }
1397 0 76 if (not defined $line) { }
3 73 elsif ($line =~ /\n/ or $line =~ /\\$/) { }
1406 0 3 if ($line =~ /$tmplimiter/s) { }
1423 73 0 unless ($this->{'NoEscape'})
1428 2 70 if ($line =~ /^\s/ or $line =~ /\s$/ or $this->{'AlwaysQuoteOutput'})
1449 0 23 if ($entry =~ /\s/)
1458 17 6 if ($num == 1)
1460 11 6 if (ref $line->{$key} eq "HASH")
1481 1 154 if ($this->{'Tie'}) { }
1485 0 1 if ($Config::General::EVAL_ERROR)
1514 0 1 if (not $file && $hash) { }
1518 0 1 if (ref $hash ne 'HASH') { }
1535 0 0 if (not $hash) { }
1539 0 0 if (ref $hash ne 'HASH') { }