line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: App::Spec objects representing command line parameters |
2
|
5
|
|
|
5
|
|
35
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
149
|
|
3
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
270
|
|
4
|
|
|
|
|
|
|
package App::Spec::Parameter; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.011'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
45
|
use base 'App::Spec::Argument'; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
538
|
|
9
|
5
|
|
|
5
|
|
33
|
use Moo; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
34
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub build { |
12
|
206
|
|
|
206
|
1
|
940
|
my ($class, %args) = @_; |
13
|
206
|
|
|
|
|
792
|
my %hash = $class->common(%args); |
14
|
206
|
|
|
|
|
5152
|
my $self = $class->new({ |
15
|
|
|
|
|
|
|
%hash, |
16
|
|
|
|
|
|
|
}); |
17
|
206
|
|
|
|
|
20960
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub to_usage_header { |
21
|
24
|
|
|
24
|
1
|
47
|
my ($self) = @_; |
22
|
24
|
|
|
|
|
46
|
my $name = $self->name; |
23
|
24
|
|
|
|
|
39
|
my $usage = ''; |
24
|
24
|
100
|
66
|
|
|
123
|
if ($self->multiple and $self->required) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
25
|
6
|
|
|
|
|
25
|
$usage = "<$name>+"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif ($self->multiple) { |
28
|
0
|
|
|
|
|
0
|
$usage = "[<$name>+]"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ($self->required) { |
31
|
18
|
|
|
|
|
68
|
$usage = "<$name>"; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
0
|
|
|
|
|
|
$usage = "[<$name>]"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
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 |
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 |