Branch Coverage

blib/lib/Sysadm/Install.pm
Criterion Covered Total %
branch 117 272 43.0


line true false branch
34 1 19 if ($on) { }
56 1 31 if ($DRY_RUN)
58 1 0 if $DRY_RUN
61 0 31 if ($CONFIRM)
63 0 0 if ($answer =~ /^\s*y\s*$/)
107 16 2 if (exists $tags{':all'})
113 0 641 unless exists $EXPORTABLE{$func}
196 0 2 unless _confirm("cp $_[0] $_[1]")
200 1 1 unless File::Copy::copy(@_)
219 0 0 unless _confirm("mv $_[0] $_[1]")
223 0 0 unless File::Copy::move(@_)
246 0 1 unless _confirm("Downloading $url => ", basename($url))
257 1 0 if ($rc != HTTP::Status::RC_OK())
291 0 3 unless @_ == 1 and defined $_[0]
294 0 3 unless _confirm("untar $_[0]")
304 1 2 if ($nice and $topdir eq $namedir) { }
0 2 elsif ($nice) { }
311 0 0 unless rename $topdir, $namedir
314 0 2 unless defined $topdir
323 0 3 unless (@extracted)
347 0 0 unless defined $tar_file and defined $dir
350 0 0 unless _confirm("Untarring $tar_file in $dir")
352 0 0 unless -d $dir
361 0 0 unless $arch->extract
408 0 0 if (@_ < 3 or ref $options ne 'ARRAY')
419 0 0 if $count eq $default
426 0 0 unless defined $input and length $input
428 0 0 if not $input =~ /^\d+$/ or $input == 0 or $input > scalar @$options
452 0 0 unless defined $opts
457 0 0 if (@_ < 2)
462 0 0 if $value eq ''
472 0 0 unless defined $opts
475 0 0 if ($opts->{'tty'})
476 0 0 unless open $fh, '>>', '/dev/tty'
480 0 0 unless print $fh $prompt
483 0 0 if ($opts->{'tty'})
495 0 0 unless defined $opts
501 0 0 if ($opts->{'tty'})
502 0 0 unless open $fh, '<', '/dev/tty'
507 0 0 if defined $input
527 0 5 unless _confirm("mkd @_")
531 1 4 unless mkpath(@_)
551 0 4 unless _confirm("rmf $_[0]")
553 2 2 unless (-e $_[0])
560 0 2 unless rmtree($_[0])
586 7 12 if ref $_[1] eq 'HASH'
588 12 7 if ($opts->{'stack_update'})
590 0 12 unless (defined $cwd)
596 1 18 unless chdir $_[0]
619 6 1 unless defined $opts
624 0 7 unless @DIR_STACK
626 1 6 if ($opts->{'reset'})
632 0 7 unless defined $old_dir
654 0 0 unless _confirm("make @_")
658 0 0 if system "make @_"
671 0 6 if ($tar_file =~ /\.tar\.gz\b|\.tgz\b/ and not Log::Log4perl::Util::module_available('IO::Zlib'))
691 0 3 unless defined $dir
705 0 3 unless @names
712 0 7 if $name eq './'
715 2 5 if ($topdir ne $archdir)
756 0 1 if (defined $files[-1] and ref $files[-1] eq 'HASH')
766 0 1 unless _confirm("editing $file in-place")
770 0 1 unless open FILE, "<$file"
773 0 1 if ($options->{'utf8'})
814 0 1 if (defined $files[-1] and ref $files[-1] eq 'HASH')
824 0 1 unless _confirm("Ploughing through $file")
828 0 1 unless open FILE, "<$file"
831 0 1 if ($options->{'utf8'})
862 3 6 unless defined $options
873 8 1 if ($from_file) { }
875 0 8 unless open FILE, "<$file"
878 1 7 if (exists $options->{'utf8'})
913 0 7 if (defined $options and ref $options eq '')
917 5 2 unless defined $options
922 7 0 unless defined $options->{'append'}
924 0 7 $options->{'append'} ? :
1 6 unless _confirm(($options->{'append'} ? 'Appending' : 'Writing') . ' ' . length($data) . " bytes to $file")
927 0 6 $options->{'append'} ? :
0 6 unless open FILE, '>' . ($options->{'append'} ? '>' : '') . $file
933 0 6 if ($options->{'utf8'})
937 0 6 unless print FILE $data
940 0 6 unless close FILE
968 0 1 unless _confirm('Writing atomically ' . length($data) . " bytes to $file")
971 1 0 unless defined $options
979 0 1 unless rename $tmpname, $file
1051 0 5 if (defined $args[-1] and ref $args[-1] eq 'HASH')
1059 0 5 unless _confirm("tapping @args")
1063 3 2 if ref $args[0] eq 'HASH'
1072 0 5 if ($opts->{'no_quotes'}) { }
0 5 elsif ($opts->{'double_quotes'}) { }
1084 0 5 unless open PIPE, $cmd
1087 0 5 if ($options->{'utf8'})
1098 0 5 if ($opts->{'stderr_limit'})
1102 1 0 if ($exit_code != 0 and $opts->{'raise_error'})
1106 1 3 if ($opts->{'stdout_limit'})
1200 3 0 if (defined $metas)
1201 1 2 if $metas eq ':shell'
1252 10 1 if (defined $metas and $metas eq ':shell') { }
1259 0 11 if (defined $metas and $metas ne ':shell')
1285 0 1 unless _confirm("perm_cp @_")
1287 0 1 if @_ < 2
1319 0 0 unless _confirm("owner_cp @_")
1321 0 0 if @_ < 2
1325 0 0 unless (defined $uid and defined $gid)
1330 0 0 unless (chown $uid, $gid, @dst)
1356 0 1 unless my(@stats) = (stat $filename)[2, 4, 5]
1383 0 1 unless _confirm("perm_set $filename (@$perms)")
1385 0 1 unless chown $perms->[1], $perms->[2], $filename
1388 0 1 unless chmod $perms->[0] & 4095, $filename
1411 0 0 unless _confirm("sysrun: @cmds")
1413 0 0 if @_ < 1
1415 0 0 if system @cmds
1438 0 0 unless _confirm("Hammer: @cmds")
1487 0 0 unless _confirm('sudo_me')
1489 0 0 unless $argv
1493 0 0 if ($> != 0)
1496 0 0 unless $sudo
1497 0 0 unless exec $sudo, $0, @$argv
1539 1 0 unless defined $options
1545 0 1 unless defined $find
1548 0 1 unless defined $cpio
1555 0 1 unless open my $in, "$cmd |"
1558 0 1 if $options->{'utf8'}
1583 1 0 unless defined $options
1589 0 1 unless defined $cpio
1591 1 0 unless -d $dir
1598 0 1 unless open my $out, "| $cmd"
1601 0 1 if $options->{'utf8'}
1632 0 0 unless (defined syswrite($out, $buf))
1636 0 0 unless (defined $ret)
1670 20 4 if (length $data <= $maxlen)
1674 2 2 if $maxlen < 12
1761 0 0 unless defined $time
1808 1 2 if (not defined $_[0])
1827 0 0 unless (utf8_available())
1847 0 0 if ($@)