| 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
| |||||||||||
| 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
| |||||||||||
| 22 | 1 | ▶ | return defined $out ? $out : ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | } | ||||||||||
| 24 | |||||||||||
| 25 | 29 | 1; | |||||||||
| 26 | |||||||||||
| 27 | __END__ | ||||||||||