Branch Coverage

blib/lib/CPAN/Plugin/Sysdeps.pm
Criterion Covered Total %
branch 179 322 55.5


line true false branch
31 15 102 if (ref $arg eq 'HASH') { }
24 78 elsif ($arg =~ /^(apt-get|aptitude|pkg|pkg_add|yum|dnf|chocolatey|homebrew|apk)$/) { }
31 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 42 if (@args_errors)
54 0 0 @args_errors != 1 ? :
57 0 42 if (exists $ENV{'CPAN_PLUGIN_SYSDEPS_DEBUG'})
60 0 42 if ($debug)
69 33 9 if ($os eq 'linux') { }
9 0 elsif ($os eq 'freebsd' or $os eq 'openbsd' or $os eq 'dragonfly') { }
72 54 27 if $linux_info
75 6 27 if (defined $options->{'linuxdistro'}) { }
81 6 27 if (defined $options->{'linuxdistroversion'}) { }
87 6 27 if (defined $options->{'linuxdistrocodename'}) { }
96 9 0 if (defined $options->{'osvers'}) { }
103 18 24 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)) { }
0 0 elsif (__PACKAGE__->_is_linux_alpine_like($linuxdistro)) { }
114 0 1 if (_detect_dnf()) { }
135 16 42 if (-r $mapping) { }
136 0 16 unless open my $fh, "<", $mapping
141 0 16 if $@
143 0 42 if $@
162 42 0 if (eval { do { require Hash::Util; 1 } })
173 2 12 if (@packages)
175 2 0 if (@uninstalled_packages)
178 2 0 if ($self->{'dryrun'}) { }
184 0 0 if ($? != 0)
196 28 0 if $info
197 0 0 if (-x '/usr/bin/lsb_release') { }
207 40 1 if (open my $fh, "<", $candidate_file)
210 470 8 if (my($k, $v) = $_ =~ /^(.*?)=["']?(.*?)["']?$/)
218 2 8 if (not defined $info{'linuxdistrocodename'} and $info{'linuxdistro'} eq "debian" and $c{'VERSION'} =~ /^\d+\s+\((.+)\)$/)
230 0 0 unless open my $fh, "-|", @cmd
234 0 0 if (/^Distributor ID:\s+(.*)/) { }
0 0 elsif (/^Release:\s+(.*)/) { }
0 0 elsif (/^Codename:\s+(.*)/) { }
244 0 0 unless close $fh
250 0 0 if (open my $fh, "<", "/etc/redhat-release")
252 0 0 if ($contents =~ /^(CentOS|Rocky|RedHat|Fedora) (?:Linux )?release (\d+)\S*( \((.*?)\))?/)
253 0 0 defined $3 ? :
256 0 0 if (open my $fh, '<', '/etc/issue') { }
258 0 0 if ($line =~ /^Linux Mint (\d+) (\S+)/) { }
0 0 elsif ($line =~ m[^(Debian) GNU/Linux (\d+)]) { }
0 0 elsif ($line =~ /^(Ubuntu) (\d+\.\d+)/) { }
317 0 0 if (/[ "]/) { }
327 0 94417 if ($self->{'debug'})
330 0 0 if (ref $_) { }
344 0 29 unless ($dist->can("base_id"))
360 180 15222 if (ref $right eq 'Regexp') { }
1951 13271 elsif (ref $right eq 'ARRAY') { }
425 12846 elsif (ref $right eq 'HASH') { }
361 3 177 if $left =~ /$right/
363 6247 0 unless not defined $left || defined $_
121 1830 if &first(sub { $_ eq $left unless not defined $left || defined $_; } , @$right)
366 0 433 unless ($op =~ /^(\<|\<\=|\=\=|\>|\>\=)$/)
372 0 433 if $@
373 259 174 unless $res
377 0 57 unless defined $left or defined $right
378 79 12767 if $left eq $right
386 28656 36846 if (ref $key_or_subentry eq 'ARRAY') { }
1 36845 elsif (ref $key_or_subentry eq 'CODE') { }
389 20 28635 if $res and not $TRAVERSE_ONLY
392 1 0 if $res and not $TRAVERSE_ONLY
397 19 36826 if ($key eq 'cpandist') { }
7474 29352 elsif ($key eq 'cpanmod') { }
5271 24081 elsif ($key eq 'os') { }
178 23903 elsif ($key eq 'osvers') { }
7766 16137 elsif ($key eq 'linuxdistro') { }
420 15717 elsif ($key eq 'linuxdistroversion') { }
1308 14409 elsif ($key eq 'linuxdistrocodename') { }
14409 0 elsif ($key eq 'package') { }
398 6 12 unless &$smartmatch($dist->base_id, $match) or $TRAVERSE_ONLY
403 15 7459 if (&$smartmatch($mod, $match))
408 2550 4909 unless $found or $TRAVERSE_ONLY
410 7 5244 unless &$smartmatch($self->{'os'}, $match) or $TRAVERSE_ONLY
412 6 84 unless &$smartmatch($self->{'osvers'}, $match) or $TRAVERSE_ONLY
414 7033 733 if ($match =~ /^~(debian|fedora|alpine)$/) { }
1 732 elsif ($match =~ /^~/) { }
417 0 4425 unless $self->$method($self->{'linuxdistro'}) or $TRAVERSE_ONLY
421 0 676 unless &$smartmatch($self->{'linuxdistro'}, $match) or $TRAVERSE_ONLY
424 0 340 unless &$smartmatch($self->{'linuxdistroversion'}, $match) or $TRAVERSE_ONLY
426 0 1199 unless &$smartmatch($self->{'linuxdistrocodename'}, $match) or $TRAVERSE_ONLY
437 0 29 unless $self->{'mapping'}
439 10 7482 if ($res and not $TRAVERSE_ONLY)
440 2 8 ref $res->{'package'} eq 'ARRAY' ? :
454 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd))
463 1 4 unless @packages
474 0 4 unless my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd)
478 0 0 if (/^(\S+) (.*)/) { }
479 0 0 if ($2 ne "install ok installed")
489 6 0 unless ($seen_packages{$package})
498 1 5 unless @packages
506 0 5 unless open my $fh, "-|", @cmd
509 4 4 if (/^package (\S+) is not installed/)
511 0 4 unless (exists $packages{$package})
518 1 4 unless @missing_packages
527 0 4 unless open my $fh, "-|", @cmd
530 3 2 if (/^no package provides (\S+)/)
532 0 3 unless (exists $packages{$package})
545 0 0 unless @packages
551 0 0 if ($? != 0)
561 0 0 unless @packages
572 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, "pkg_info", $package))
574 0 0 if ($? == 0)
579 0 0 if ($package_in_repository)
582 0 0 if ($? != 0)
593 0 0 unless @packages
598 0 0 unless open my $fh, "-|", @cmd
608 0 0 unless ($has_package)
617 0 0 unless @packages
620 0 0 unless /^(.*)\|(.*)$/
632 0 0 unless @packages
638 0 0 if ($? != 0)
649 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') { }
0 0 elsif ($self->{'installer'} eq 'apk') { }
666 4 0 if ($find_missing_packages)
670 1 4 if ($package_spec =~ /\|/) { }
673 1 0 if (@missing_in_packages_spec == @single_packages)
692 1 12 if ($self->{'installer'} eq 'homebrew') { }
0 12 elsif ($self->{'installer'} eq 'chocolatey') { }
697 0 12 if ($< != 0)
703 1 12 if ($self->{'installer'} eq 'homebrew') { }
0 12 elsif ($self->{'installer'} eq 'chocolatey') { }
712 4 9 if ($self->{'batch'}) { }
713 3 1 if ($self->_is_apt_installer) { }
0 1 elsif ($self->{'installer'} eq 'yum' or $self->{'installer'} eq 'dnf') { }
0 1 elsif ($self->{'installer'} eq 'pkg') { }
0 1 elsif ($self->{'installer'} eq 'homebrew') { }
1 0 elsif ($self->{'installer'} eq 'apk') { }
727 3 6 if ($self->_is_apt_installer) { }
2 4 elsif ($self->{'installer'} eq 'yum' or $self->{'installer'} eq 'dnf') { }
1 3 elsif ($self->{'installer'} eq 'pkg') { }
0 3 elsif ($self->{'installer'} =~ /^(chocolatey)$/) { }
1 2 elsif ($self->{'installer'} eq 'homebrew') { }
1 1 elsif ($self->{'installer'} eq 'apk') { }
746 1 12 if ($self->{'installer'} eq "pkg")
751 2 11 if ($self->{'installer'} eq 'apk') { }
10 1 elsif ($self->{'installer'} ne 'pkg_add') { }
758 0 13 if ($self->{'batch'} and $self->{'installer'} eq "pkg")
761 0 13 if ($self->{'batch'} and $self->{'installer'} eq "chocolatey")
764 0 13 if ($self->{'batch'} and $self->{'installer'} eq "pkg_add")
770 0 13 if ($self->{'os'} eq "MSWin32")
775 5 8 @pre_cmd ? :