CLI/Cmd.pm

filter: Statementstmt 60.6% 20 / 33 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 58.7% 27 / 46 CC 3 SCAR 15.4
CC
3
Cov
54%
appspec_openapi
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.7
« CLI/Request.pm ↑ Summary
1 # ABSTRACT:
2 package API::CLI::Cmd;
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '0.001_001'; # TRIAL VERSION
7  
8 1 ▶use feature qw/ say /;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use base 'App::Spec::Run::Cmd';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use API::CLI::App::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use YAML::XS qw/ LoadFile DumpFile Dump /;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 0 ▶sub appspec_openapi {
Subroutine appspec_openapi: not called CC=3 SCAR=24.8
Pod documented
14 0 my ($self, $run) = @_;
15 0 my $options = $run->options;
16 0 my $parameters = $run->parameters;
17  
18 0 my $openapi_file = $parameters->{file};
19 0 my $outfile = $options->{out};
20 0 ▶ my $class = $options->{class} || 'API::CLI';
Condition0%0/2
$options->{'class'} || 'API::CLI'
l!l
00
MC/DC0%0/1
$options->{'class'} || 'API::CLI'
$options->{'class'}
Truth table0%0/2
A
A= $options->{'class'}
Aresult
11
00
21 0 my $name = $options->{name};
22  
23 0 my $openapi = LoadFile($openapi_file);
24  
25 0 my $appspec = API::CLI::App::Spec->openapi2appspec(
26 openapi => $openapi,
27 name => $name,
28 class => $class,
29 );
30 0 ▶ if (defined $outfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $outfile) { } 0 0 0
31 0 DumpFile($outfile, $appspec);
32 0 say "Wrote appspec to $outfile";
33 }
34 else {
35 0 print Dump $appspec;
36 }
37 }
38  
39 1 1;
40  
41 __END__
« CLI/Request.pm ↑ Summary