| 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
| |||||||||||
| 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
| |||||||||||
| 24 | # uncoverable branch false | ||||||||||
| 25 | 1 | ▶ | return defined $out ? $out : ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 33 | 1; | |||||||||
| 29 | |||||||||||
| 30 | __END__ | ||||||||||