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|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+)/) { }
279 0 0 if (/[ "]/) { }
289 0 11943 if ($self->{'debug'})
292 0 0 if (ref $_) { }
306 0 18 unless ($dist->can('base_id'))
321 30 3463 if (ref $right eq 'Regexp') { }
426 3037 elsif (ref $right eq 'ARRAY') { }
28 3009 elsif (ref $right eq 'HASH') { }
322 3 27 if $left =~ /$right/
324 46 380 if &first(sub { $_ eq $left; } , @$right)
327 0 30 unless ($op =~ /^(\<|\<\=|\=\=|\>|\>\=)$/)
333 0 30 if $@
334 23 7 unless $res
338 13 2996 if $left eq $right
346 2249 5168 if (ref $key_or_subentry eq 'ARRAY') { }
1 5167 elsif (ref $key_or_subentry eq 'CODE') { }
349 20 2228 if $res and not $TRAVERSE_ONLY
352 1 0 if $res and not $TRAVERSE_ONLY
357 15 5152 if ($key eq 'cpandist') { }
2854 2298 elsif ($key eq 'cpanmod') { }
436 1862 elsif ($key eq 'os') { }
16 1846 elsif ($key eq 'osvers') { }
596 1250 elsif ($key eq 'linuxdistro') { }
29 1221 elsif ($key eq 'linuxdistroversion') { }
98 1123 elsif ($key eq 'linuxdistrocodename') { }
1123 0 elsif ($key eq 'package') { }
358 12 2 unless &$smartmatch($dist->base_id, $match) or $TRAVERSE_ONLY
363 15 2839 if (&$smartmatch($mod, $match))
368 2446 393 unless $found or $TRAVERSE_ONLY
370 7 420 unless &$smartmatch($self->{'os'}, $match) or $TRAVERSE_ONLY
372 6 5 unless &$smartmatch($self->{'osvers'}, $match) or $TRAVERSE_ONLY
374 550 46 if ($match =~ /^~(debian|fedora)$/) { }
1 45 elsif ($match =~ /^~/) { }
377 0 206 unless $self->$method($self->{'linuxdistro'}) or $TRAVERSE_ONLY
381 0 45 unless &$smartmatch($self->{'linuxdistro'}, $match) or $TRAVERSE_ONLY
384 0 27 unless &$smartmatch($self->{'linuxdistroversion'}, $match) or $TRAVERSE_ONLY
386 0 63 unless &$smartmatch($self->{'linuxdistrocodename'}, $match) or $TRAVERSE_ONLY
397 0 18 unless $self->{'mapping'}
399 10 2858 if ($res and not $TRAVERSE_ONLY)
400 2 8 ref $res->{'package'} eq 'ARRAY' ? :
414 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd))
423 1 4 unless @packages
434 0 4 unless my $pid = IPC::Open3::open3(undef, $fh, $err, @cmd)
438 0 0 if (/^(\S+) (.*)/) { }
439 0 0 if ($2 ne 'install ok installed')
449 6 0 unless ($seen_packages{$package})
458 0 0 unless @packages
467 0 0 unless open my $fh, '-|', @cmd
470 0 0 if (/^package (\S+) is not installed/)
472 0 0 unless (exists $packages{$package})
485 0 0 unless @packages
491 0 0 if ($? != 0)
501 0 0 unless @packages
512 0 0 if (my $pid = IPC::Open3::open3(undef, $fh, $err, 'pkg_info', $package))
514 0 0 if ($? == 0)
519 0 0 if ($package_in_repository)
522 0 0 if ($? != 0)
533 0 0 unless @packages
538 0 0 unless open my $fh, '-|', @cmd
548 0 0 unless ($has_package)
557 0 0 unless @packages
560 0 0 unless /^(.*)\|(.*)$/
573 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') { }
588 4 0 if ($find_missing_packages)
592 1 4 if ($package_spec =~ /\|/) { }
595 1 0 if (@missing_in_packages_spec == @single_packages)
614 1 10 if ($self->{'installer'} eq 'homebrew') { }
0 10 elsif ($self->{'installer'} eq 'chocolatey') { }
619 0 10 if ($< != 0)
625 1 10 if ($self->{'installer'} eq 'homebrew') { }
632 3 8 if ($self->{'batch'}) { }
633 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') { }
645 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') { }
662 1 10 if ($self->{'installer'} eq 'pkg')
667 10 1 if ($self->{'installer'} ne 'pkg_add')
672 0 11 if ($self->{'batch'} and $self->{'installer'} eq 'pkg')
675 0 11 if ($self->{'batch'} and $self->{'installer'} eq 'chocolatey')
678 0 11 if ($self->{'batch'} and $self->{'installer'} eq 'pkg_add')
684 0 11 if ($self->{'os'} eq 'MSWin32')
689 4 7 @pre_cmd ? :