Branch Coverage

blib/lib/CPAN/Plugin/Sysdeps.pm
Criterion Covered Total %
branch 189 334 56.5


line true false branch
31 15 106 if (ref $arg eq 'HASH') { }
24 82 elsif ($arg =~ /^(apt-get|aptitude|pkg|pkg_add|yum|dnf|chocolatey|homebrew|apk)$/) { }
33 49 elsif ($arg eq 'batch') { }
1 48 elsif ($arg eq 'interactive') { }
32 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 44 if (@args_errors)
54 0 0 @args_errors != 1 ? :
57 0 44 if (exists $ENV{'CPAN_PLUGIN_SYSDEPS_DEBUG'})
60 0 44 if ($debug)
69 35 9 if ($os eq 'linux') { }
9 0 elsif ($os eq 'freebsd' or $os eq 'openbsd' or $os eq 'dragonfly') { }
72 58 29 if $linux_info
75 6 29 if (defined $options->{'linuxdistro'}) { }
81 6 29 if (defined $options->{'linuxdistroversion'}) { }
87 6 29 if (defined $options->{'linuxdistrocodename'}) { }
96 9 0 if (defined $options->{'osvers'}) { }
103 20 24 unless ($installer)
104 9 11 if ($os eq 'freebsd' or $os eq 'dragonfly') { }
0 11 elsif ($os eq 'gnukfreebsd') { }
0 11 elsif ($os eq 'openbsd') { }
11 0 elsif ($os eq 'linux') { }
0 0 elsif ($os eq 'MSWin32') { }
0 0 elsif ($os eq 'darwin') { }
111 10 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 44 if (-r $mapping) { }
136 0 16 unless open my $fh, "<", $mapping
141 0 16 if $@
143 0 44 if $@
164 44 0 if (eval { do { require Hash::Util; 1 } })
185 18 0 if (not $self->{'_mapper_ran'}{$dist->id})
196 4 13 if (@packages)
198 4 0 if (@uninstalled_packages)
201 4 0 if ($self->{'dryrun'}) { }
207 0 0 if ($? != 0)
218 30 0 if $info
219 0 0 if (-x '/usr/bin/lsb_release') { }
228 43 1 if (open my $fh, "<", $candidate_file)
231 509 8 if (my($k, $v) = $_ =~ /^(.*?)=["']?(.*?)["']?$/)
242 42 1 if ($c)
248 2 8 if (not defined $info{'linuxdistrocodename'} and $info{'linuxdistro'} eq "debian" and $c->{'VERSION'} =~ /^\d+\s+\((.+)\)$/)
259 0 0 unless open my $fh, "-|", @cmd
263 0 0 if (/^Distributor ID:\s+(.*)/) { }
0 0 elsif (/^Release:\s+(.*)/) { }
0 0 elsif (/^Codename:\s+(.*)/) { }
273 0 0 unless close $fh
279 0 0 if (open my $fh, "<", "/etc/redhat-release")
281 0 0 if ($contents =~ /^(CentOS|Rocky|RedHat|Fedora) (?:Linux )?release (\d+)\S*( \((.*?)\))?/)
282 0 0 defined $3 ? :
285 0 0 if (open my $fh, '<', '/etc/issue') { }
287 0 0 if ($line =~ /^Linux Mint (\d+) (\S+)/) { }
0 0 elsif ($line =~ m[^(Debian) GNU/Linux (\d+)]) { }
0 0 elsif ($line =~ /^(Ubuntu) (\d+\.\d+)/) { }
349 0 0 if (/[ "]/) { }
359 0 96478 if ($self->{'debug'})
362 0 0 if (ref $_) { }
376 0 834 unless ($dist->can("base_id"))
389 808 7800 if (not @containsmods and $self->_dist_get_base_id($dist) eq ".")
390 397 411 if (defined $ENV{'CPAN_PLUGIN_SYSDEPS_MODULE'})
394 1 410 unless ($self->{'_containsmods_warned'}++)
411 0 22 if defined $cached_base_id
421 183 15986 if (ref $right eq 'Regexp') { }
2029 13957 elsif (ref $right eq 'ARRAY') { }
425 13532 elsif (ref $right eq 'HASH') { }
422 3 180 if $left =~ /$right/
424 6427 0 unless not defined $left || defined $_
121 1908 if &first(sub { $_ eq $left unless not defined $left || defined $_; } , @$right)
427 0 433 unless ($op =~ /^(\<|\<\=|\=\=|\>|\>\=)$/)
433 0 433 if $@
434 259 174 unless $res
438 0 57 unless defined $left or defined $right
439 81 13451 if $left eq $right
447 28738 38063 if (ref $key_or_subentry eq 'ARRAY') { }
1 38062 elsif (ref $key_or_subentry eq 'CODE') { }
450 24 28713 if $res and not $TRAVERSE_ONLY
453 1 0 if $res and not $TRAVERSE_ONLY
458 22 38040 if ($key eq 'cpandist') { }
8606 29434 elsif ($key eq 'cpanmod') { }
5313 24121 elsif ($key eq 'os') { }
178 23943 elsif ($key eq 'osvers') { }
7768 16175 elsif ($key eq 'linuxdistro') { }
420 15755 elsif ($key eq 'linuxdistroversion') { }
1308 14447 elsif ($key eq 'linuxdistrocodename') { }
14447 0 elsif ($key eq 'package') { }
459 9 12 unless &$smartmatch(&$get_base_id(), $match) or $TRAVERSE_ONLY
464 17 8179 if (&$smartmatch($mod, $match))
469 3668 4921 unless $found or $TRAVERSE_ONLY
471 13 5280 unless &$smartmatch($self->{'os'}, $match) or $TRAVERSE_ONLY
473 6 84 unless &$smartmatch($self->{'osvers'}, $match) or $TRAVERSE_ONLY
475 7035 733 if ($match =~ /^~(debian|fedora|alpine)$/) { }
1 732 elsif ($match =~ /^~/) { }
478 0 4425 unless $self->$method($self->{'linuxdistro'}) or $TRAVERSE_ONLY
482 0 676 unless &$smartmatch($self->{'linuxdistro'}, $match) or $TRAVERSE_ONLY
485 0 340 unless &$smartmatch($self->{'linuxdistroversion'}, $match) or $TRAVERSE_ONLY
487 0 1199 unless &$smartmatch($self->{'linuxdistrocodename'}, $match) or $TRAVERSE_ONLY
498 0 32 unless $self->{'mapping'}
500 12 8615 if ($res and not $TRAVERSE_ONLY)
501 2 10 ref $res->{'package'} eq 'ARRAY' ? :
515 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd))
524 1 6 unless @packages
535 0 6 unless my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd)
539 0 0 if (/^(\S+) (.*)/) { }
540 0 0 if ($2 ne "install ok installed")
550 8 0 unless ($seen_packages{$package})
559 1 5 unless @packages
567 0 5 unless open my $fh, "-|", @cmd
570 4 4 if (/^package (\S+) is not installed/)
572 0 4 unless (exists $packages{$package})
579 1 4 unless @missing_packages
588 0 4 unless open my $fh, "-|", @cmd
591 3 2 if (/^no package provides (\S+)/)
593 0 3 unless (exists $packages{$package})
606 0 0 unless @packages
612 0 0 if ($? != 0)
622 0 0 unless @packages
633 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, "pkg_info", $package))
635 0 0 if ($? == 0)
640 0 0 if ($package_in_repository)
643 0 0 if ($? != 0)
654 0 0 unless @packages
659 0 0 unless open my $fh, "-|", @cmd
669 0 0 unless ($has_package)
678 0 0 unless @packages
681 0 0 unless /^(.*)\|(.*)$/
693 0 0 unless @packages
699 0 0 if ($? != 0)
710 6 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') { }
727 6 0 if ($find_missing_packages)
731 1 6 if ($package_spec =~ /\|/) { }
734 1 0 if (@missing_in_packages_spec == @single_packages)
753 1 14 if ($self->{'installer'} eq 'homebrew') { }
0 14 elsif ($self->{'installer'} eq 'chocolatey') { }
758 0 14 if ($< != 0)
764 1 14 if ($self->{'installer'} eq 'homebrew') { }
0 14 elsif ($self->{'installer'} eq 'chocolatey') { }
773 6 9 if ($self->{'batch'}) { }
774 5 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') { }
788 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') { }
807 1 14 if ($self->{'installer'} eq "pkg")
812 2 13 if ($self->{'installer'} eq 'apk') { }
12 1 elsif ($self->{'installer'} ne 'pkg_add') { }
819 0 15 if ($self->{'batch'} and $self->{'installer'} eq "pkg")
822 0 15 if ($self->{'batch'} and $self->{'installer'} eq "chocolatey")
825 0 15 if ($self->{'batch'} and $self->{'installer'} eq "pkg_add")
831 0 15 if ($self->{'os'} eq "MSWin32")
836 5 10 @pre_cmd ? :