Simple/DumpSpec.pm

filter: Statementstmt 54.0% 20 / 37 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 50.9% 26 / 51 CC 4 SCAR 21.5
CC
4
Cov
47%
_cmd_dump_spec
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 8.6
« Simple/Modulino.pm ↑ Summary Simple/Migrate.pm »
1 package CLI::Simple::DumpSpec;
2  
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 ▶use CLI::Simple::Constants qw(:booleans);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 11 ▶use CLI::Simple::Helpers qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 11 ▶use parent qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 11 our @EXPORT_OK = qw(_cmd_dump_spec);
13  
14 ########################################################################
15 0 ▶sub _cmd_dump_spec {
Subroutine _cmd_dump_spec: not called CC=4 SCAR=30.0
16 ########################################################################
17 0 my ( $class, $commands, $option_specs ) = @_;
18  
19 0 ▶ my $use_roles = ( $ARGV[1] // q{} ) eq 'roles';
Condition0%0/2
$ARGV[1] // ""
l!l
00
MC/DC0%0/1
$ARGV[1] // ""
$ARGV[1]
Truth table0%0/2
A
A= $ARGV[1]
Aresult
11
00
20  
21 0 my $spec_file = _spec_filename($class);
22 0 my $yaml = _generate_spec_yaml( $class, $commands, $option_specs, $use_roles );
23  
24 0 ▶ open my $fh, '>', $spec_file
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $spec_file or die "ERROR: could not write ${spec_file}: $CLI::Simple::DumpSpec::OS_ERROR\n" 0 0 0
25 or die "ERROR: could not write $spec_file: $OS_ERROR\n";
26  
27 0 print {$fh} $yaml;
28  
29 0 ▶ close $fh
Branch: 1 branch
BranchTrueFalseTotal
close $fh or warn "WARNING: could not close ${spec_file}: $CLI::Simple::DumpSpec::OS_ERROR\n" 0 0 0
30 or warn "WARNING: could not close $spec_file: $OS_ERROR\n";
31  
32 0 printf {*STDOUT} "wrote %s\n", $spec_file;
33 0 printf {*STDOUT} "your main() can now be replaced with:\n\n";
34 0 printf {*STDOUT} " caller or exit __PACKAGE__->main;\n\n";
35 0 printf {*STDOUT} "see: perldoc CLI::Simple\n";
36  
37 0 return $SUCCESS;
38 }
39  
40 11 1;
41  
42 __END__
« Simple/Modulino.pm ↑ Summary Simple/Migrate.pm »