Branch Coverage

blib/lib/Config/FileManager.pm
Criterion Covered Total %
branch 44 70 62.8


line true false branch
265 0 1 unless exists $settings{$required}
272 0 3 unless $self->can($attrib)
279 2 3 unless defined $settings{$attrib}
301 1 8 if (@_)
322 1 2 if (@_)
344 1 2 if (@_)
365 1 1 if (@_)
385 3 15 if (@_)
405 2 9 unless (@{$self->{'allVersions'};})
409 7 2 if (ref $cur_ver eq 'HASH')
437 2 11 if (@_)
466 0 12 unless exists $params{$required}
469 0 4 if defined $self->{'patches'}{'patch from v' . $params{'from'}}
487 10 1 if defined $self->{'full_path'}
497 1 0 if (-e $path)
499 0 1 if (-e "$full_path")
509 0 1 if ($path =~ /^__APPDIR__$/)
514 1 0 if (-e $path)
522 0 1 unless open CFG_FILE, '>' . $full_path
547 0 1 unless open CFG_FILE, '<' . $self->getPath
553 1 6 if (/^#.*configuration file (\d+.\d+.\d+.*)$/)
559 1 0 if ($current_user_config_version ne $self->version)
569 1 0 if ($diffs) { }
580 1 0 unless (eval { do { my $old_default_config = $self->getDefaultContent($current_user_config_version); $old_default_config =~ s/$current_user_config_version/__VERSION__/; $current_user_config =~ s/$current_user_config_version/__VERSION__/; $diffs = diff(\$old_default_config, \$current_user_config, {'STYLE', 'OldStyle'}); if ($diffs) { $current_user_config = patch($self->defaultContent, $diffs, {'STYLE', 'OldStyle'}); } else { $current_user_config = $self->getDefaultContent; } ; my $v = $self->version; $current_user_config =~ s/__VERSION__/$v/; $_ = 1 } })
589 0 1 if ($self->interactive) { }
590 0 0 $diffs ? :
595 1 0 if ($answer eq "Y\n" or $answer eq "y\n" or not $diffs and $answer eq "\n") { }
597 0 1 unless open CFG_FILE, '>' . $self->getPath
601 0 0 if ($self->interactive) { }
607 0 0 unless $answer eq "Y\n" or $answer eq "y\n"
634 0 9 unless (grep /^$wanted_version$/, $self->versions)
644 8 10 if ($k =~ /^patch from v$computed_version$/)
651 8 0 if ($kk =~ /^to v(.*)$/)
660 8 0 if (defined $str and defined $previous_version)
675 0 9 unless (eval { do { unless (grep /^$wanted_version$/, $self->versions) { $error = "version '${wanted_version}' is not valid."; } ; while (not defined $error and $computed_version ne $wanted_version) { $error = "Unable to find a patch from version '${computed_version}'"; foreach my $k (keys %{$$self{'patches'};}) { if ($k =~ /^patch from v$computed_version$/) { my($previous_version, $str); $error = "Unable to find a patch to version '${wanted_version}'"; foreach my $kk (keys %{$$self{'patches'}{$k};}) { if ($kk =~ /^to v(.*)$/) { $previous_version = $1; $str = $self->{'patches'}{$k}{$kk}; $str =~ s/^\s+//; $str =~ s/\s+$/\n/; last; } ; } ; if (defined $str and defined $previous_version) { $error = "Unable to apply the patch from version v$computed_version to v$previous_version\n"; $computed_config = patch($computed_config, $str, {'STYLE', 'Unified'}); $computed_version = $previous_version; $error = undef; last; } ; } ; } ; } ; $computed_config =~ s/__VERSION__/$computed_version/; not defined $error } })