Branch Coverage

blib/lib/CPAN/Plugin/Sysdeps.pm
Criterion Covered Total %
branch 151 286 52.8


line true false branch
29 14 66 if (ref $arg eq 'HASH') { }
11 55 elsif ($arg =~ /^(apt-get|aptitude|pkg|pkg_add|yum|dnf|chocolatey|homebrew)$/) { }
19 36 elsif ($arg eq 'batch') { }
1 35 elsif ($arg eq 'interactive') { }
19 16 elsif ($arg eq 'dryrun') { }
16 0 elsif ($arg =~ /^mapping=(.*)$/) { }
0 0 elsif ($arg =~ /^debug(?:=(\d+))?$/) { }
30 0 14 if ($options) { }
46 0 0 defined $1 ? :
51 0 28 if (@args_errors)
52 0 0 @args_errors != 1 ? :
55 0 28 if (exists $ENV{'CPAN_PLUGIN_SYSDEPS_DEBUG'})
58 0 28 if ($debug)
67 19 9 if ($os eq 'linux') { }
9 0 elsif ($os eq 'freebsd' or $os eq 'openbsd' or $os eq 'dragonfly') { }
70 28 14 if $linux_info
73 5 14 if (defined $options->{'linuxdistro'}) { }
79 5 14 if (defined $options->{'linuxdistroversion'}) { }
85 5 14 if (defined $options->{'linuxdistrocodename'}) { }
94 9 0 if (defined $options->{'osvers'}) { }
101 17 11 unless ($installer)
102 9 8 if ($os eq 'freebsd' or $os eq 'dragonfly') { }
0 8 elsif ($os eq 'gnukfreebsd') { }
0 8 elsif ($os eq 'openbsd') { }
8 0 elsif ($os eq 'linux') { }
0 0 elsif ($os eq 'MSWin32') { }
0 0 elsif ($os eq 'darwin') { }
109 8 0 if ('CPAN::Plugin::Sysdeps'->_is_linux_debian_like($linuxdistro)) { }
0 0 elsif ('CPAN::Plugin::Sysdeps'->_is_linux_fedora_like($linuxdistro)) { }
112 0 0 if (_detect_dnf()) { }
131 16 28 if (-r $mapping) { }
132 0 16 unless open my $fh, "<", $mapping
137 0 16 if $@
139 0 28 if $@
158 28 0 if (eval { do { require Hash::Util; 1 } })
169 2 1 if (@packages)
171 2 0 if (@uninstalled_packages)
174 2 0 if ($self->{'dryrun'}) { }
180 0 0 if ($? != 0)
191 0 14 if (-x '/usr/bin/lsb_release') { }
201 0 0 unless open my $fh, "-|", @cmd
205 0 0 if (/^Distributor ID:\s+(.*)/) { }
0 0 elsif (/^Release:\s+(.*)/) { }
0 0 elsif (/^Codename:\s+(.*)/) { }
215 0 0 unless close $fh
221 0 14 if (open my $fh, "<", "/etc/redhat-release")
223 0 0 if ($contents =~ /^(CentOS|Rocky|RedHat|Fedora) (?:Linux )?release (\d+)\S*( \((.*?)\))?/)
224 0 0 defined $3 ? :
227 14 0 if (open my $fh, '<', '/etc/issue') { }
229 0 14 if ($line =~ /^Linux Mint (\d+) (\S+)/) { }
0 14 elsif ($line =~ m[^(Debian) GNU/Linux (\d+)]) { }
14 0 elsif ($line =~ /^(Ubuntu) (\d+\.\d+)/) { }
281 0 0 if (/[ "]/) { }
291 0 12124 if ($self->{'debug'})
294 0 0 if (ref $_) { }
308 0 18 unless ($dist->can("base_id"))
323 31 3506 if (ref $right eq 'Regexp') { }
431 3075 elsif (ref $right eq 'ARRAY') { }
30 3045 elsif (ref $right eq 'HASH') { }
324 3 28 if $left =~ /$right/
326 48 383 if &first(sub { $_ eq $left; } , @$right)
329 0 34 unless ($op =~ /^(\<|\<\=|\=\=|\>|\>\=)$/)
335 0 34 if $@
336 24 10 unless $res
340 13 3032 if $left eq $right
348 2294 5244 if (ref $key_or_subentry eq 'ARRAY') { }
1 5243 elsif (ref $key_or_subentry eq 'CODE') { }
351 20 2273 if $res and not $TRAVERSE_ONLY
354 1 0 if $res and not $TRAVERSE_ONLY
359 15 5228 if ($key eq 'cpandist') { }
2882 2346 elsif ($key eq 'cpanmod') { }
442 1904 elsif ($key eq 'os') { }
17 1887 elsif ($key eq 'osvers') { }
608 1279 elsif ($key eq 'linuxdistro') { }
30 1249 elsif ($key eq 'linuxdistroversion') { }
103 1146 elsif ($key eq 'linuxdistrocodename') { }
1146 0 elsif ($key eq 'package') { }
360 12 2 unless &$smartmatch($dist->base_id, $match) or $TRAVERSE_ONLY
365 15 2867 if (&$smartmatch($mod, $match))
370 2470 397 unless $found or $TRAVERSE_ONLY
372 7 426 unless &$smartmatch($self->{'os'}, $match) or $TRAVERSE_ONLY
374 6 5 unless &$smartmatch($self->{'osvers'}, $match) or $TRAVERSE_ONLY
376 559 49 if ($match =~ /^~(debian|fedora)$/) { }
1 48 elsif ($match =~ /^~/) { }
379 0 211 unless $self->$method($self->{'linuxdistro'}) or $TRAVERSE_ONLY
383 0 48 unless &$smartmatch($self->{'linuxdistro'}, $match) or $TRAVERSE_ONLY
386 0 28 unless &$smartmatch($self->{'linuxdistroversion'}, $match) or $TRAVERSE_ONLY
388 0 66 unless &$smartmatch($self->{'linuxdistrocodename'}, $match) or $TRAVERSE_ONLY
399 0 18 unless $self->{'mapping'}
401 10 2886 if ($res and not $TRAVERSE_ONLY)
402 2 8 ref $res->{'package'} eq 'ARRAY' ? :
416 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd))
425 1 4 unless @packages
436 0 4 unless my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd)
440 0 0 if (/^(\S+) (.*)/) { }
441 0 0 if ($2 ne "install ok installed")
451 6 0 unless ($seen_packages{$package})
460 0 0 unless @packages
469 0 0 unless open my $fh, "-|", @cmd
472 0 0 if (/^package (\S+) is not installed/)
474 0 0 unless (exists $packages{$package})
487 0 0 unless @packages
493 0 0 if ($? != 0)
503 0 0 unless @packages
514 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, "pkg_info", $package))
516 0 0 if ($? == 0)
521 0 0 if ($package_in_repository)
524 0 0 if ($? != 0)
535 0 0 unless @packages
540 0 0 unless open my $fh, "-|", @cmd
550 0 0 unless ($has_package)
559 0 0 unless @packages
562 0 0 unless /^(.*)\|(.*)$/
575 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') { }
590 4 0 if ($find_missing_packages)
594 1 4 if ($package_spec =~ /\|/) { }
597 1 0 if (@missing_in_packages_spec == @single_packages)
616 1 10 if ($self->{'installer'} eq 'homebrew') { }
0 10 elsif ($self->{'installer'} eq 'chocolatey') { }
621 0 10 if ($< != 0)
627 1 10 if ($self->{'installer'} eq 'homebrew') { }
634 3 8 if ($self->{'batch'}) { }
635 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') { }
647 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') { }
664 1 10 if ($self->{'installer'} eq "pkg")
669 10 1 if ($self->{'installer'} ne "pkg_add")
674 0 11 if ($self->{'batch'} and $self->{'installer'} eq "pkg")
677 0 11 if ($self->{'batch'} and $self->{'installer'} eq "chocolatey")
680 0 11 if ($self->{'batch'} and $self->{'installer'} eq "pkg_add")
686 0 11 if ($self->{'os'} eq "MSWin32")
691 4 7 @pre_cmd ? :