blib/lib/Punk/Config.pm

filter: Statementstmt 100% 21 / 21 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 90.6% 29 / 32 CC 4 SCAR 9.5
CC
4
Cov
89%
_exec
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.6
« t/lib/Punk/Command/Fakecmd.pm ↑ Summary blib/arch/Punk/Install/Files.pm »
1 package Punk::Config;
2  
3 29 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 29 ▶use Punk ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 29 our $VERSION = '0.69';
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=14.2
16 1 my (@cmd) = @_;
17 1 ▶ open my $ph, '-|', @cmd
Branch: 1 branch
BranchTrueFalseTotal
open my $ph, "-|", @cmd or die "cannot run '$cmd[0]': $!\n" 1 0 1
18 or die "cannot run '$cmd[0]': $!\n";
19 1 my $out = do { local $/; <$ph> };
20 1 close $ph;
21 1 ▶ die "'$cmd[0]' exited with " . ($? >> 8) . "\n" if $?;
Branch: 1 branch
BranchTrueFalseTotal
if $? 0 1 1
22 1 ▶ return defined $out ? $out : '';
Branch: 1 branch
BranchTrueFalseTotal
defined $out ? : 1 0 1
23 }
24  
25 29 1;
26  
27 __END__
« t/lib/Punk/Command/Fakecmd.pm ↑ Summary blib/arch/Punk/Install/Files.pm »