Simple/DumpSpec.pm

filter: Statementstmt 55.2% 21 / 38 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 51.9% 27 / 52 CC 4 SCAR 21.5
CC
4
Cov
48%
_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 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 17 ▶use CLI::Simple::Constants qw(:booleans);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 17 ▶use CLI::Simple::Helpers qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 17 ▶use English qw(-no_match_vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 17 ▶use parent qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 17 our @EXPORT_OK = qw(_cmd_dump_spec);
13 17 our $VERSION = '2.6.0';
14  
15 ########################################################################
16 0 ▶sub _cmd_dump_spec {
Subroutine _cmd_dump_spec: not called CC=4 SCAR=30.0
17 ########################################################################
18 0 my ( $class, $commands, $option_specs ) = @_;
19  
20 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
21  
22 0 my $spec_file = _spec_filename($class);
23 0 my $yaml = _generate_spec_yaml( $class, $commands, $option_specs, $use_roles );
24  
25 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
26 or die "ERROR: could not write $spec_file: $OS_ERROR\n";
27  
28 0 print {$fh} $yaml;
29  
30 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
31 or warn "WARNING: could not close $spec_file: $OS_ERROR\n";
32  
33 0 printf {*STDOUT} "wrote %s\n", $spec_file;
34 0 printf {*STDOUT} "your main() can now be replaced with:\n\n";
35 0 printf {*STDOUT} " caller or exit __PACKAGE__->main;\n\n";
36 0 printf {*STDOUT} "see: perldoc CLI::Simple\n";
37  
38 0 return $SUCCESS;
39 }
40  
41 17 1;
42  
43 __END__
« Simple/Modulino.pm ↑ Summary Simple/Migrate.pm »