Branch Coverage

blib/lib/Config/GitLike.pm
Criterion Covered Total %
branch 232 290 80.0


line true false branch
94 0 302 unless defined $name
107 0 51 wantarray ? :
125 56 184 if (-f $path)
127 56 0 unless $self->cascade
160 127 162 unless -f $filename and -r $filename
161 0 162 unless open my $fh, '<', $filename
162 1 161 if (my $encoding = $self->encoding)
177 178 0 if (ref $ref) { }
184 178 0 if @_ % 2
203 0 178 if grep {$_ eq $filename;} @{$self->config_files;} and not $args{'force'}
207 0 178 if not $c and $args{'silent'}
208 115 63 unless (defined $c)
209 0 115 unless ref $ref
216 63 0 if $self->include and $args{'includes'}
219 0 63 unless $self->is_loaded
226 0 334 unless $self->include and $args{'includes'}
228 334 0 unless lc($def{'section'} || '') eq lc($sec || '')
229 0 0 unless ($def{'subsection'} || '') eq ($subsec || '')
230 0 0 unless lc($def{'name'} || '') eq lc($name || '')
232 0 0 if $args{'depth'} > $self->max_depth
288 11 146 unless $c
291 11 135 $self->compatible ? :
295 11 135 $self->compatible ? :
299 11 135 $self->compatible ? :
310 90 993 if ($c =~ s/\A[#;].*?$//im) { }
323 670 elsif ($c =~ s/$section_regex//) { }
5 665 elsif ($c =~ s/$key_regex//) { }
519 146 elsif ($c =~ s/$key_value_regex//) { }
137 9 elsif (not length $c) { }
324 72 251 if ($2)
329 0 72 if $check =~ /\\|"/
357 0 5 unless defined $section
371 0 519 unless defined $section
380 519 773 if ($c =~ s/\A([ \t]*[#;].*?)?$//im) { }
57 716 elsif ($c =~ s/\A[\t ]+//im) { }
2 714 elsif ($c =~ s/\A\\\r?\n//im) { }
90 624 elsif ($c =~ s/\A\\\\//im) { }
32 592 elsif ($c =~ s/\A\\(['"])//im) { }
0 592 elsif ($c =~ s/\A\\n//im) { }
0 592 elsif ($c =~ s/\A\\t//im) { }
0 592 elsif ($c =~ s/\A\\b//im) { }
12 580 elsif ($c =~ s/\A"([^"\\]*(?:(?:\\\n|\\[tbn"\\])[^"\\]*)*)"//im) { }
580 0 elsif ($c =~ s/\A([^\t \\\n"]+)//im) { }
474 128 206 unless defined $args{'section'} and defined $args{'name'}
481 193 13 if (not defined $self->origins->{$key} or $self->origins->{$key} eq $args{'origin'}) { }
483 1 192 if ($self->is_multiple($key)) { }
8 184 elsif (exists $self->data->{$key}) { }
500 0 13 if $self->is_multiple($key)
524 14 92 if (defined $args{'as'} and $args{'as'} eq 'bool-or-int')
525 6 8 if ($args{'value'} =~ /^-?[0-9]*\.?[0-9]*[kmg]?$/) { }
8 0 elsif ($args{'value'} =~ /^(?:true|yes|on|-?0*1)$/ or $args{'value'} =~ /^(?:false|no|off|0*)$/) { }
0 0 elsif (not defined $args{'value'}) { }
541 58 48 unless defined $args{'as'}
542 34 14 if ($args{'as'} =~ /bool/i) { }
14 0 elsif ($args{'as'} =~ /int|num/) { }
543 1 33 unless defined $v
544 16 17 if ($v =~ /^(?:true|yes|on|-?0*1)$/) { }
15 2 elsif ($v =~ /^(?:false|no|off|0*)$/) { }
545 9 7 if ($args{'human'}) { }
553 8 7 if ($args{'human'}) { }
565 1 13 unless $v =~ /^-?[0-9]*\.?[0-9]*[kmg]?$/
568 3 10 if ($v =~ s/([kmg])$//)
569 1 2 if $1 eq 'k'
570 2 1 if $1 eq 'm'
571 0 3 if $1 eq 'g'
574 12 1 $args{'as'} eq 'int' ? :
585 0 75 unless $self->is_loaded
589 0 75 unless exists $self->data->{$args{'key'}}
591 8 67 ref $v ? :
592 5 70 if (defined $args{'filter'} and length $args{'filter'})
593 0 5 if ($args{'filter'} eq '!') { }
2 3 elsif ($args{'filter'} =~ s/^!//) { }
600 3 1 if defined $_
630 1 69 unless @v
631 1 68 if @v > 1
649 0 5 wantarray ? :
663 0 5 unless $self->is_loaded
665 0 5 unless defined $args{'key'} and length $args{'key'}
669 10 6 if $key =~ /$args{'key'}/i
672 1 4 if (defined $args{'filter'} and length $args{'filter'})
673 0 1 if ($args{'filter'} eq '!') { }
1 0 elsif ($args{'filter'} =~ s/^!//) { }
678 2 1 if defined $results{$_} and $results{$_} =~ /$args{'filter'}/i
684 0 0 unless defined $results{$_} and $results{$_} =~ /$args{'filter'}/i
696 0 5 wantarray ? :
717 0 5 unless $self->is_loaded
719 2 3 if wantarray
724 9 0 if (defined $self->data->{$key}) { }
728 0 9 if ($self->is_multiple($key)) { }
740 0 9 if (not defined wantarray) { }
748 3 0 if defined wantarray
760 7 25 if ($args{'section'} =~ /^(.*?)\.(.*)$/) { }
763 5 2 unless $args{'bare'}
768 25 0 unless $args{'bare'}
781 4 79 $args{'value'} =~ /(^\s|;|#|\s$)/ ? :
787 72 11 unless $args{'bare'}
799 4 977 if ($key =~ s/\.["'](.*)["']$//) { }
833 4 99 unless defined $section
836 7 92 if $self->_invalid_variable_name($name)
839 2 90 if $self->_invalid_section_name($section)
845 5 85 if (defined $subsection)
851 20 70 if defined $args{'value'} and defined $args{'as'}
862 85 4 unless defined $args{'multiple'}
866 5 84 defined $unescaped_subsection ? :
871 5 84 defined $subsection ? :
887 277 204 unless $got{'section'} eq $cmp_section
889 58 146 unless defined $got{'name'}
893 28 118 if (lc $name eq lc $got{'name'})
894 8 20 if (defined $args{'filter'} and length $args{'filter'}) { }
899 0 8 if ($filter eq '!') { }
3 5 elsif ($filter =~ s/^!//) { }
3 2 elsif ($got{'value'} =~ /$filter/i) { }
903 1 2 unless $got{'value'} =~ /$filter/i
914 24 122 if $matched
922 1 88 if @replace > 1 and not $args{'multiple'}
927 13 5 if @replace and $args{'value'} and not $args{'replace_all'}
929 83 5 if (defined $args{'value'}) { }
930 11 72 if (@replace and !$args{'multiple'} || $args{'filter'} || $args{'replace_all'}) { }
42 30 elsif (defined $new) { }
983 1 4 unless @replace
1020 4 2 $newline > $bracket ? :
1055 7 92 if ($self->compatible) { }
1067 3 89 if ($self->compatible) { }
1086 1 469 if defined $readlink
1092 0 94 unless sysopen my $fh, "$filename.lock", 193
1094 1 93 if (my $encoding = $self->encoding)
1101 0 94 unless rename "$filename.lock", $filename
1115 0 5 unless defined $args{'from'}
1119 0 5 unless defined $c
1131 5 27 if @replace and not defined $got{'name'}
1134 14 18 if (lc $got{'section'} eq lc $args{'from'}) { }
1135 7 7 if (defined $got{'name'}) { }
1140 4 3 if ($prev_matched and not defined $args{'to'})
1152 1 2 if @replace and $prev_matched and not defined $args{'to'}
1166 1 3 if @replace and $prev_matched and not defined $args{'to'}
1176 1 4 unless @replace
1186 2 2 defined $args{'to'} ? :
1190 2 5 !defined($args{'to'}) && $$header{'section_is_last'} ? :
1214 0 2 unless $args{'section'}
1231 0 4 unless my $filename = $args{'filename'}
1232 0 4 unless defined $args{'comment'}
1235 1 3 $args{'indented'} ? :
1236 1 3 $args{'semicolon'} ? :
1238 4 0 unless $comment =~ /\n\z/
1241 1 3 unless defined $c