| 1 | package Catmandu::Cmd::run; | ||||||||||||||||||||||||||||
| 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; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 14 | ▶ | use Catmandu::Util qw(require_package); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 14 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | sub command_opt_spec { | ||||||||||||||||||||||||||
|
Subroutine
command_opt_spec: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 13 | ( | ||||||||||||||||||||||||||||
| 14 | 1 | ["var=s%", ""], | |||||||||||||||||||||||||||
| 15 | ["fix=s@", ""], | ||||||||||||||||||||||||||||
| 16 | ["preprocess|pp", ""], | ||||||||||||||||||||||||||||
| 17 | ["verbose|v", ""], | ||||||||||||||||||||||||||||
| 18 | ["i", "interactive mode"], | ||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | sub command { | ||||||||||||||||||||||||||
|
Subroutine
command: called CC=7 SCAR=24.4
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | 1 | my ($self, $opts, $args) = @_; | |||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | ▶ | if (defined $opts->{i} || !defined $args->[0]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $opts->{"i"} or not defined $args->[0]
MC/DC0%0/2
defined $opts->{"i"} or not defined $args->[0]
defined $opts->{"i"}
not defined $args->[0]
Truth table33%1/3
A or not(B)
A= defined $opts->{"i"}B= not defined $args->[0]
| |||||||||||||||||||||||||||||
| 26 | 0 | my $pkg = require_package('Catmandu::Interactive'); | |||||||||||||||||||||||||||
| 27 | 0 | my $app = Catmandu::Interactive->new(); | |||||||||||||||||||||||||||
| 28 | 0 | $app->run(); | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | else { | ||||||||||||||||||||||||||||
| 31 | 1 | my $fix_file = $args->[0]; | |||||||||||||||||||||||||||
| 32 | 1 | ▶ | $fix_file = [\*STDIN] unless defined $fix_file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 1 | $opts->{fix} = [$fix_file]; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 1 | my $from = Catmandu->importer('Null'); | |||||||||||||||||||||||||||
| 37 | 1 | $from = $self->_build_fixer($opts)->fix($from); | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 1 | ▶ | if ($opts->verbose) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | $from = $from->benchmark; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 1 | my $into = Catmandu->exporter('Null'); | |||||||||||||||||||||||||||
| 44 | 1 | my $n = $into->add_many($from); | |||||||||||||||||||||||||||
| 45 | 1 | $into->commit; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 1 | ▶ | if ($opts->verbose) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | say STDERR $n == 1 ? "converted 1 item" : "converted $n items"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | say STDERR "done"; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 14 | 1; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||||||||||