Branch Coverage

blib/lib/Config/General.pm
Criterion Covered Total %
branch 301 420 71.6


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
527 5 0 if (not exists $this->{'files'}{$file} or $this->{'IncludeAgain'}) { }
542 1 62 if (exists $this->{'files'}{$configfile} and not $this->{'IncludeAgain'}) { }
567 0 67 unless my $fh = "IO::File"->new($file, "r")
575 4 63 if $this->{'UTF8'} or $has_BOM
578 63 4 if $n_read and not $has_BOM
597 15 67 if ($flag and $flag eq 'SCALAR') { }
598 0 15 if (ref $fh eq 'ARRAY') { }
611 0 82 unless $cont
613 3 79 if ($this->{'UseApacheIfDefine'})
618 0 766 if ($this->{'AutoLaunder'})
619 0 0 if (/^(.*)$/)
627 25 741 if ($hier)
629 7 18 if (/^(\s*)\Q$hierend\E\s*$/) { }
633 0 7 if ($indent) { }
654 741 0 if ($this->{'CComments'})
656 2 739 if (m[(\s*/\*.*\*/\s*)]) { }
15 724 elsif (m[^\s*/\*]) { }
15 709 elsif (m[\*/]) { }
662 0 15 if (m[\*/\s*$]) { }
671 0 15 unless ($c_comment)
677 152 589 if $c_comment
682 0 589 if /^\s*#/
685 9 580 if (/(?
694 3 577 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 507 70 if ($this->{'SplitPolicy'} eq 'guess') { }
718 2 505 if (/^\s*([^=]+?)\s*=\s*<<\s*(.+?)\s*$/) { }
5 500 elsif (/^\s*(\S+?)\s+<<\s*(.+?)\s*$/) { }
733 1 69 if (/^\s*(.+?)($this->{'SplitDelimiter'})<<\s*(.+?)\s*$/)
746 5 564 if ($longline) { }
756 131 433 if /^\s*$/
761 87 346 if ($this->{'IncludeRelative'} and defined $this->{'CurrentConfigFilePath'}) { }
0 346 elsif (defined $this->{'ConfigPath'}) { }
770 16 417 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 417 if (/^\s*<>\\s*$/i) { }
17 400 elsif (/^\s*<>\s*$/i) { }
804 21 412 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 614 if (/$this->{'EOFseparator'}/) { }
897 499 115 if ($this->{'SplitPolicy'} eq 'guess') { }
908 0 621 if ($this->{'NormalizeOption'})
912 9 431 if ($value and $value =~ /^"/ and $value =~ /"$/)
916 335 286 if (not defined $block) { }
21 265 elsif (m[^<([^/]+?.*?)>$]) { }
107 158 elsif (m[^$]) { }
917 86 249 if (m[^<([^/]+?.*?)>$]) { }
0 249 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 249 if ($this->{'LowerCaseNames'})
963 25 224 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 222 if ($this->{'ForceArray'} and defined $value and $value =~ /^\[\s*(.+?)\s*\]$/) { }
1008 72 150 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 134 if ($block)
1182 0 249 unless $cont
1185 4 245 unless (defined $value)
1191 0 245 if ($this->{'NormalizeValue'})
1195 73 172 if ($this->{'InterPolateVars'})
1200 46 199 if ($this->{'AutoTrue'})
1201 7 39 if ($value =~ /$this->{'AutoTrueFlags'}{'true'}/io) { }
9 30 elsif ($value =~ /$this->{'AutoTrueFlags'}{'false'}/io) { }
1210 35 210 if ($this->{'FlagBits'})
1211 2 33 if (exists $this->{'FlagBitsFlags'}{$option})
1214 5 1 if (exists $__flags{$flag}) { }
1225 244 1 unless ($this->{'NoEscape'})
1239 0 728 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 0 1 if (not $config or ref $config ne 'HASH') { }
1326 0 0 if (exists $this->{'config'}) { }
1351 15 16 $this->{'SaveSorted'} ? :
1353 1 92 if ($entry =~ /[<>\n\r]/)
1357 5 87 if (ref $config->{$entry} eq 'ARRAY') { }
21 66 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 75 if (not defined $line) { }
3 72 elsif ($line =~ /\n/ or $line =~ /\\$/) { }
1406 0 3 if ($line =~ /$tmplimiter/s) { }
1423 72 0 unless ($this->{'NoEscape'})
1429 2 70 if ($line =~ /^\s/ or $line =~ /\s$/)
1449 0 23 if ($entry =~ /\s/)
1458 17 6 if ($num == 1)
1460 11 6 if (ref $line->{$key} eq "HASH")
1481 1 153 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') { }