| 1 | package Zed::Config::Env; | ||||||||||||||||||||
| 2 | 1 | ▶ | use Term::ReadPassword; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | =head1 NAME | ||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | Zed::Config::Env - Zed runtime variables. | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | =head1 SYNOPSIS | ||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | use Zed::Config::Env; | ||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | env 'foo' => 'value'; #Set foo | ||||||||||||||||||||
| 13 | env 'foo'; #Get foo | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | passwd; #Get password. Input it if not defined. | ||||||||||||||||||||
| 16 | passwd(undef); #Get password. Force to input it. | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | =cut | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 1 | ▶ | use base Exporter; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | 1 | our @EXPORT = qw( env passwd ); | |||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 1 | ▶ | use Zed::Output; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 1 | ▶ | use base Zed::Config; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | 1 | our $NAME = "Env"; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | sub env | ||||||||||||||||||||
| 29 | { | ||||||||||||||||||||
| 30 | 0 | ▶ | my ($key, $value) = @_; | ||||||||||||||||||
|
Subroutine
env: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 31 | 0 | my $config = __PACKAGE__->config; | |||||||||||||||||||
| 32 | 0 | debug("config", $config); | |||||||||||||||||||
| 33 | 0 | debug("key:|$key| value:|$value|"); | |||||||||||||||||||
| 34 | $key ? $value ? $config->{$key} = $value : $config->{$key} | ||||||||||||||||||||
| 35 | 0 | ▶ | : wantarray ? %$config : \%{$config}; | ||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 1 | my $passwd; | |||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | sub passwd | ||||||||||||||||||||
| 41 | { | ||||||||||||||||||||
| 42 | 0 | ▶ | $passwd = $_[0] if @_; | ||||||||||||||||||
|
Subroutine
passwd: not called CC=3 SCAR=24.8
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||
| 43 | 0 | ▶ | $passwd ||= read_password('password: '); | ||||||||||||||||||
|
Condition0%0/3
$passwd ||= read_password("password: ")
MC/DC0%0/2
$passwd ||= read_password("password: ")
$passwd
read_password("password: ")
Truth table0%0/3
A ||= B
A= $passwdB= read_password("password: ")
| |||||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | 1 | 1; | |||||||||||||||||||