| 1 | # ABSTRACT: App::Spec objects representing command line parameters | ||||||||||||||||||||||||||||||||||||
| 2 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | package App::Spec::Parameter; | ||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||
| 6 | 9 | our $VERSION = 'v0.15.1'; # TRIAL VERSION | |||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||
| 8 | 9 | ▶ | use base 'App::Spec::Argument'; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 9 | 9 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||
| 11 | 271 | ▶ | sub build { | ||||||||||||||||||||||||||||||||||
|
Subroutine
build: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 12 | 271 | my ($class, %args) = @_; | |||||||||||||||||||||||||||||||||||
| 13 | 271 | my %hash = $class->common(%args); | |||||||||||||||||||||||||||||||||||
| 14 | 271 | my $self = $class->new({ | |||||||||||||||||||||||||||||||||||
| 15 | %hash, | ||||||||||||||||||||||||||||||||||||
| 16 | }); | ||||||||||||||||||||||||||||||||||||
| 17 | 271 | return $self; | |||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||
| 20 | 39 | ▶ | sub to_usage_header { | ||||||||||||||||||||||||||||||||||
|
Subroutine
to_usage_header: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||
| 21 | 39 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||
| 22 | 39 | my $name = $self->name; | |||||||||||||||||||||||||||||||||||
| 23 | 39 | my $usage = ''; | |||||||||||||||||||||||||||||||||||
| 24 | 39 | ▶ | if ($self->multiple and $self->required) { | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$self->multiple and $self->required
MC/DC50%1/2
$self->multiple and $self->required
$self->multiple
$self->required
Truth table66%2/3
A and B
A= $self->multipleB= $self->required
| |||||||||||||||||||||||||||||||||||||
| 25 | 8 | $usage = "<$name>+"; | |||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||
| 27 | elsif ($self->multiple) { | ||||||||||||||||||||||||||||||||||||
| 28 | 0 | $usage = "[<$name>+]"; | |||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||
| 30 | elsif ($self->required) { | ||||||||||||||||||||||||||||||||||||
| 31 | 28 | $usage = "<$name>"; | |||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||
| 33 | else { | ||||||||||||||||||||||||||||||||||||
| 34 | 3 | $usage = "[<$name>]"; | |||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||
| 38 | 9 | 1; | |||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||
| 40 | =pod | ||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||
| 42 | =head1 NAME | ||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||
| 44 | App::Spec::Parameter - App::Spec objects representing command line parameters | ||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||
| 46 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||
| 48 | This class inherits from L<App::Spec::Argument> | ||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||
| 50 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||
| 52 | =over 4 | ||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||
| 54 | =item build | ||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||
| 56 | my $param = App::Spec::Parameter->build( | ||||||||||||||||||||||||||||||||||||
| 57 | name => 'verbose', | ||||||||||||||||||||||||||||||||||||
| 58 | summary => 'lala', | ||||||||||||||||||||||||||||||||||||
| 59 | ); | ||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||
| 61 | =item to_usage_header | ||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||
| 63 | my $param_usage_header = $param->to_usage_header; | ||||||||||||||||||||||||||||||||||||
| 64 | # results | ||||||||||||||||||||||||||||||||||||
| 65 | # if multiple and required | ||||||||||||||||||||||||||||||||||||
| 66 | # <$name>+ | ||||||||||||||||||||||||||||||||||||
| 67 | # if multiple | ||||||||||||||||||||||||||||||||||||
| 68 | # [<$name>+] | ||||||||||||||||||||||||||||||||||||
| 69 | # if required | ||||||||||||||||||||||||||||||||||||
| 70 | # <$name> | ||||||||||||||||||||||||||||||||||||
| 71 | # else | ||||||||||||||||||||||||||||||||||||
| 72 | # [<$name>} | ||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||
| 74 | =back | ||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||
| 76 | =cut | ||||||||||||||||||||||||||||||||||||