| 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] // ""
MC/DC0%0/1
$ARGV[1] // ""
$ARGV[1]
Truth table0%0/2
A
A= $ARGV[1]
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 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__ | ||||||||||||