line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: App::Spec objects representing command line parameters |
2
|
5
|
|
|
5
|
|
38
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
151
|
|
3
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
278
|
|
4
|
|
|
|
|
|
|
package App::Spec::Parameter; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.013'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
45
|
use base 'App::Spec::Argument'; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
574
|
|
9
|
5
|
|
|
5
|
|
35
|
use Moo; |
|
5
|
|
|
|
|
18
|
|
|
5
|
|
|
|
|
22
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub build { |
12
|
206
|
|
|
206
|
1
|
985
|
my ($class, %args) = @_; |
13
|
206
|
|
|
|
|
824
|
my %hash = $class->common(%args); |
14
|
206
|
|
|
|
|
4875
|
my $self = $class->new({ |
15
|
|
|
|
|
|
|
%hash, |
16
|
|
|
|
|
|
|
}); |
17
|
206
|
|
|
|
|
21232
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub to_usage_header { |
21
|
24
|
|
|
24
|
1
|
43
|
my ($self) = @_; |
22
|
24
|
|
|
|
|
45
|
my $name = $self->name; |
23
|
24
|
|
|
|
|
42
|
my $usage = ''; |
24
|
24
|
100
|
66
|
|
|
126
|
if ($self->multiple and $self->required) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
25
|
6
|
|
|
|
|
26
|
$usage = "<$name>+"; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
elsif ($self->multiple) { |
28
|
0
|
|
|
|
|
0
|
$usage = "[<$name>+]"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
elsif ($self->required) { |
31
|
18
|
|
|
|
|
71
|
$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 |