Catmandu/Cmd/config.pm

filter: Statementstmt 93.7% 30 / 32 Branchbran 83.3% 5 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.5% 7 / 8 Podpod 100% 2 / 2 totaltotal 84.9% 45 / 53 CC 5 SCAR 10.3
CC
5
Cov
88%
command
5.2
_default_exporter
2.0
BEGIN
1.0
CRAP 2.8
« Catmandu/Fix/string.pm ↑ Summary Catmandu/Util/Path.pm »
1 package Catmandu::Cmd::config;
2  
3 14 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 14 our $VERSION = '1.2025';
6  
7 14 ▶use parent 'Catmandu::Cmd';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 14 ▶use Catmandu::Util::Path qw(as_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 14 ▶use Catmandu;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 14 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 ▶sub command_opt_spec {
Subroutine command_opt_spec: called CC=1 SCAR=0.0
Pod documented
13 3 (["fix=s@", ""], ["var=s%", ""], ["preprocess|pp", ""],);
14 }
15  
16 3 ▶sub command {
Subroutine command: called CC=5 SCAR=16.4
Pod documented
17 3 my ($self, $opts, $args) = @_;
18 3 my $from;
19 my $into;
20  
21 3 my ($from_args, $from_opts, $into_args, $into_opts)
22 = $self->_parse_options($args);
23  
24 3 ▶ if (@$from_args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$from_args) { } 1 2 3
25 1 $from = as_path($from_args->[0])->getter->(Catmandu->config);
26 }
27 else {
28 2 $from = Catmandu->config;
29 }
30  
31 3 ▶ if (@$into_args || %$into_opts) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$into_args or %$into_opts) { } 3 0 3
Condition33%1/3
@$into_args or %$into_opts
l!l&&r!l&&!r
300
MC/DC0%0/2
@$into_args or %$into_opts
@$into_args %$into_opts
Truth table33%1/3
A or B
A= @$into_argsB= %$into_opts
ABresult
1X1
011
000
32 3 $into = Catmandu->exporter($into_args->[0], $into_opts);
33 }
34 else {
35 0 $into = $self->_default_exporter;
36 }
37  
38 3 ▶ if ($opts->fix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opts->fix) 1 2 3
39 1 $from = $self->_build_fixer($opts)->fix($from);
40 }
41  
42 3 $into->add($from);
43 3 $into->commit;
44 }
45  
46 0 ▶sub _default_exporter {
Subroutine _default_exporter: not called CC=1 SCAR=6.9
47 0 Catmandu->exporter('JSON', pretty => 1, array => 0);
48 }
49  
50 14 1;
51  
52 __END__
« Catmandu/Fix/string.pm ↑ Summary Catmandu/Util/Path.pm »