| 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
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
@$into_args or %$into_opts
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||