blib/lib/Punk/Config.pm

filter: Statementstmt 100% 21 / 21 Branchbran 83.3% 3 / 6 (3 uncoverable) Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 96.8% 29 / 32 (3 uncoverable) CC 4 SCAR 9.2
CC
4
Cov
96%
_exec
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« t/lib/Punk/Command/Fakecmd.pm ↑ Summary blib/arch/Punk/Install/Files.pm »
1 package Punk::Config;
2  
3 33 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 33 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 33 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 33 ▶use Punk ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 33 our $VERSION = '0.70';
9  
10 # Capture a command's standard output. Called from C for { $exec: ... }; a
11 # non-zero exit is fatal, so a broken secret store stops the boot rather than
12 # yielding an empty password. A list is run directly. A single string is what
13 # perl's piped open makes of one: run directly when it is plain words, handed
14 # to the shell when it holds a shell metacharacter.
15 1 ▶sub _exec {
Subroutine _exec: called CC=4 SCAR=13.9
16 1 my (@cmd) = @_;
17 # uncoverable branch true class:ignore_covered_err
18 1 ▶ open my $ph, '-|', @cmd
Branch: 1 branch
BranchTrueFalseTotal
open my $ph, "-|", @cmd or die "cannot run '$cmd[0]': $!\n" 1 0 1
19 or die "cannot run '$cmd[0]': $!\n";
20 1 my $out = do { local $/; <$ph> };
21 1 close $ph;
22 # uncoverable branch true
23 1 ▶ die "'$cmd[0]' exited with " . ($? >> 8) . "\n" if $?;
Branch: 1 branch
BranchTrueFalseTotal
if $? 0 1 1
24 # uncoverable branch false
25 1 ▶ return defined $out ? $out : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $out ? : 1 0 1
26 }
27  
28 33 1;
29  
30 __END__
« t/lib/Punk/Command/Fakecmd.pm ↑ Summary blib/arch/Punk/Install/Files.pm »