blib/lib/Zed/Config/Env.pm

filter: Statementstmt 66.6% 16 / 24 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 44.4% 20 / 45 CC 6 SCAR 23.9
CC
6
Cov
46%
env
20.0
passwd
12.0
BEGIN
1.0
CRAP 10.9
« blib/lib/Zed/Config/Space.pm ↑ Summary blib/lib/Zed/Range/Set.pm »
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
BranchTrueFalseTotal
$key ? : 0 0 0
$value ? : 0 0 0
wantarray ? : 0 0 0
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
BranchTrueFalseTotal
if @_ 0 0 0
43 0 ▶ $passwd ||= read_password('password: ');
Condition0%0/3
$passwd ||= read_password("password: ")
l!l&&r!l&&!r
000
MC/DC0%0/2
$passwd ||= read_password("password: ")
$passwd read_password("password: ")
Truth table0%0/3
A ||= B
A= $passwdB= read_password("password: ")
ABresult
1X1
011
000
44 }
45 1 1;
« blib/lib/Zed/Config/Space.pm ↑ Summary blib/lib/Zed/Range/Set.pm »