Branch Coverage

blib/lib/CPAN/Plugin/Sysdeps.pm
Criterion Covered Total %
branch 169 306 55.2


line true false branch
31 15 99 if (ref $arg eq 'HASH') { }
22 77 elsif ($arg =~ /^(apt-get|aptitude|pkg|pkg_add|yum|dnf|chocolatey|homebrew)$/) { }
30 47 elsif ($arg eq 'batch') { }
1 46 elsif ($arg eq 'interactive') { }
30 16 elsif ($arg eq 'dryrun') { }
16 0 elsif ($arg =~ /^mapping=(.*)$/) { }
0 0 elsif ($arg =~ /^debug(?:=(\d+))?$/) { }
32 0 15 if ($options) { }
48 0 0 defined $1 ? :
53 0 40 if (@args_errors)
54 0 0 @args_errors != 1 ? :
57 0 40 if (exists $ENV{'CPAN_PLUGIN_SYSDEPS_DEBUG'})
60 0 40 if ($debug)
69 31 9 if ($os eq 'linux') { }
9 0 elsif ($os eq 'freebsd' or $os eq 'openbsd' or $os eq 'dragonfly') { }
72 50 25 if $linux_info
75 6 25 if (defined $options->{'linuxdistro'}) { }
81 6 25 if (defined $options->{'linuxdistroversion'}) { }
87 6 25 if (defined $options->{'linuxdistrocodename'}) { }
96 9 0 if (defined $options->{'osvers'}) { }
103 18 22 unless ($installer)
104 9 9 if ($os eq 'freebsd' or $os eq 'dragonfly') { }
0 9 elsif ($os eq 'gnukfreebsd') { }
0 9 elsif ($os eq 'openbsd') { }
9 0 elsif ($os eq 'linux') { }
0 0 elsif ($os eq 'MSWin32') { }
0 0 elsif ($os eq 'darwin') { }
111 8 1 if (__PACKAGE__->_is_linux_debian_like($linuxdistro)) { }
1 0 elsif (__PACKAGE__->_is_linux_fedora_like($linuxdistro)) { }
114 0 1 if (_detect_dnf()) { }
133 16 40 if (-r $mapping) { }
134 0 16 unless open my $fh, "<", $mapping
139 0 16 if $@
141 0 40 if $@
160 40 0 if (eval { do { require Hash::Util; 1 } })
171 2 12 if (@packages)
173 2 0 if (@uninstalled_packages)
176 2 0 if ($self->{'dryrun'}) { }
182 0 0 if ($? != 0)
194 26 0 if $info
195 0 0 if (-x '/usr/bin/lsb_release') { }
205 38 1 if (open my $fh, "<", $candidate_file)
208 444 8 if (my($k, $v) = $_ =~ /^(.*?)=["']?(.*?)["']?$/)
216 2 8 if (not defined $info{'linuxdistrocodename'} and $info{'linuxdistro'} eq "debian" and $c{'VERSION'} =~ /^\d+\s+\((.+)\)$/)
228 0 0 unless open my $fh, "-|", @cmd
232 0 0 if (/^Distributor ID:\s+(.*)/) { }
0 0 elsif (/^Release:\s+(.*)/) { }
0 0 elsif (/^Codename:\s+(.*)/) { }
242 0 0 unless close $fh
248 0 0 if (open my $fh, "<", "/etc/redhat-release")
250 0 0 if ($contents =~ /^(CentOS|Rocky|RedHat|Fedora) (?:Linux )?release (\d+)\S*( \((.*?)\))?/)
251 0 0 defined $3 ? :
254 0 0 if (open my $fh, '<', '/etc/issue') { }
256 0 0 if ($line =~ /^Linux Mint (\d+) (\S+)/) { }
0 0 elsif ($line =~ m[^(Debian) GNU/Linux (\d+)]) { }
0 0 elsif ($line =~ /^(Ubuntu) (\d+\.\d+)/) { }
310 0 0 if (/[ "]/) { }
320 0 92273 if ($self->{'debug'})
323 0 0 if (ref $_) { }
337 0 29 unless ($dist->can("base_id"))
353 174 14873 if (ref $right eq 'Regexp') { }
1915 12958 elsif (ref $right eq 'ARRAY') { }
389 12569 elsif (ref $right eq 'HASH') { }
354 3 171 if $left =~ /$right/
356 5903 0 unless not defined $left || defined $_
109 1806 if &first(sub { $_ eq $left unless not defined $left || defined $_; } , @$right)
359 0 400 unless ($op =~ /^(\<|\<\=|\=\=|\>|\>\=)$/)
365 0 400 if $@
366 251 149 unless $res
370 0 57 unless defined $left or defined $right
371 72 12497 if $left eq $right
379 27960 35999 if (ref $key_or_subentry eq 'ARRAY') { }
1 35998 elsif (ref $key_or_subentry eq 'CODE') { }
382 20 27939 if $res and not $TRAVERSE_ONLY
385 1 0 if $res and not $TRAVERSE_ONLY
390 37 35961 if ($key eq 'cpandist') { }
7365 28596 elsif ($key eq 'cpanmod') { }
5223 23373 elsif ($key eq 'os') { }
166 23207 elsif ($key eq 'osvers') { }
7502 15705 elsif ($key eq 'linuxdistro') { }
372 15333 elsif ($key eq 'linuxdistroversion') { }
1272 14061 elsif ($key eq 'linuxdistrocodename') { }
14061 0 elsif ($key eq 'package') { }
391 12 24 unless &$smartmatch($dist->base_id, $match) or $TRAVERSE_ONLY
396 15 7350 if (&$smartmatch($mod, $match))
401 2513 4837 unless $found or $TRAVERSE_ONLY
403 7 5196 unless &$smartmatch($self->{'os'}, $match) or $TRAVERSE_ONLY
405 6 72 unless &$smartmatch($self->{'osvers'}, $match) or $TRAVERSE_ONLY
407 6889 613 if ($match =~ /^~(debian|fedora)$/) { }
1 612 elsif ($match =~ /^~/) { }
410 0 4324 unless $self->$method($self->{'linuxdistro'}) or $TRAVERSE_ONLY
414 0 563 unless &$smartmatch($self->{'linuxdistro'}, $match) or $TRAVERSE_ONLY
417 0 320 unless &$smartmatch($self->{'linuxdistroversion'}, $match) or $TRAVERSE_ONLY
419 0 1175 unless &$smartmatch($self->{'linuxdistrocodename'}, $match) or $TRAVERSE_ONLY
430 0 29 unless $self->{'mapping'}
432 10 7391 if ($res and not $TRAVERSE_ONLY)
433 2 8 ref $res->{'package'} eq 'ARRAY' ? :
447 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd))
456 1 4 unless @packages
467 0 4 unless my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd)
471 0 0 if (/^(\S+) (.*)/) { }
472 0 0 if ($2 ne "install ok installed")
482 6 0 unless ($seen_packages{$package})
491 1 5 unless @packages
499 0 5 unless open my $fh, "-|", @cmd
502 4 4 if (/^package (\S+) is not installed/)
504 0 4 unless (exists $packages{$package})
511 1 4 unless @missing_packages
520 0 4 unless open my $fh, "-|", @cmd
523 3 2 if (/^no package provides (\S+)/)
525 0 3 unless (exists $packages{$package})
538 0 0 unless @packages
544 0 0 if ($? != 0)
554 0 0 unless @packages
565 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, "pkg_info", $package))
567 0 0 if ($? == 0)
572 0 0 if ($package_in_repository)
575 0 0 if ($? != 0)
586 0 0 unless @packages
591 0 0 unless open my $fh, "-|", @cmd
601 0 0 unless ($has_package)
610 0 0 unless @packages
613 0 0 unless /^(.*)\|(.*)$/
626 4 0 if ($self->_is_apt_installer) { }
0 0 elsif ($self->{'installer'} eq 'yum' or $self->{'installer'} eq 'dnf') { }
0 0 elsif ($self->{'os'} eq 'freebsd' or $self->{'os'} eq 'dragonfly') { }
0 0 elsif ($self->{'os'} eq 'openbsd') { }
0 0 elsif ($self->{'os'} eq 'MSWin32') { }
0 0 elsif ($self->{'installer'} eq 'homebrew') { }
641 4 0 if ($find_missing_packages)
645 1 4 if ($package_spec =~ /\|/) { }
648 1 0 if (@missing_in_packages_spec == @single_packages)
667 1 10 if ($self->{'installer'} eq 'homebrew') { }
0 10 elsif ($self->{'installer'} eq 'chocolatey') { }
672 0 10 if ($< != 0)
678 1 10 if ($self->{'installer'} eq 'homebrew') { }
685 3 8 if ($self->{'batch'}) { }
686 3 0 if ($self->_is_apt_installer) { }
0 0 elsif ($self->{'installer'} eq 'yum' or $self->{'installer'} eq 'dnf') { }
0 0 elsif ($self->{'installer'} eq 'pkg') { }
0 0 elsif ($self->{'installer'} eq 'homebrew') { }
698 3 5 if ($self->_is_apt_installer) { }
2 3 elsif ($self->{'installer'} eq 'yum' or $self->{'installer'} eq 'dnf') { }
1 2 elsif ($self->{'installer'} eq 'pkg') { }
0 2 elsif ($self->{'installer'} =~ /^(chocolatey)$/) { }
1 1 elsif ($self->{'installer'} eq 'homebrew') { }
715 1 10 if ($self->{'installer'} eq "pkg")
720 10 1 if ($self->{'installer'} ne "pkg_add")
725 0 11 if ($self->{'batch'} and $self->{'installer'} eq "pkg")
728 0 11 if ($self->{'batch'} and $self->{'installer'} eq "chocolatey")
731 0 11 if ($self->{'batch'} and $self->{'installer'} eq "pkg_add")
737 0 11 if ($self->{'os'} eq "MSWin32")
742 4 7 @pre_cmd ? :