line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::App::Cmd; # git description: v0.33-2-ga6c151d |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.34'; |
4
|
|
|
|
|
|
|
|
5
|
3
|
|
|
3
|
|
1084137
|
use Moose; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
27
|
|
6
|
3
|
|
|
3
|
|
23276
|
use MooseX::NonMoose; |
|
3
|
|
|
|
|
3477
|
|
|
3
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
extends 'App::Cmd'; |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
231532
|
use namespace::autoclean; |
|
3
|
|
|
|
|
25714
|
|
|
3
|
|
|
|
|
16
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
## no critic (Modules::RequireExplicitInclusion) |
12
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
13
|
|
|
|
|
|
|
1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ABSTRACT: Mashes up MooseX::Getopt and App::Cmd |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__END__ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=pod |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=encoding UTF-8 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
MooseX::App::Cmd - Mashes up MooseX::Getopt and App::Cmd |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 VERSION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
version 0.34 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package YourApp::Cmd; |
34
|
|
|
|
|
|
|
use Moose; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
extends qw(MooseX::App::Cmd); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package YourApp::Cmd::Command::blort; |
40
|
|
|
|
|
|
|
use Moose; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
extends qw(MooseX::App::Cmd::Command); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has blortex => ( |
45
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
46
|
|
|
|
|
|
|
isa => 'Bool', |
47
|
|
|
|
|
|
|
is => 'rw', |
48
|
|
|
|
|
|
|
cmd_aliases => 'X', |
49
|
|
|
|
|
|
|
documentation => 'use the blortext algorithm', |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has recheck => ( |
53
|
|
|
|
|
|
|
traits => [qw(Getopt)], |
54
|
|
|
|
|
|
|
isa => 'Bool', |
55
|
|
|
|
|
|
|
is => 'rw', |
56
|
|
|
|
|
|
|
cmd_aliases => 'r', |
57
|
|
|
|
|
|
|
documentation => 'recheck all results', |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub execute { |
61
|
|
|
|
|
|
|
my ( $self, $opt, $args ) = @_; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# you may ignore $opt, it's in the attributes anyway |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $result = $self->blortex ? blortex() : blort(); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
recheck($result) if $self->recheck; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
print $result; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 DESCRIPTION |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This module marries L<App::Cmd|App::Cmd> with L<MooseX::Getopt|MooseX::Getopt>. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Use it like L<App::Cmd|App::Cmd> advises (especially see |
77
|
|
|
|
|
|
|
L<App::Cmd::Tutorial|App::Cmd::Tutorial>), swapping |
78
|
|
|
|
|
|
|
L<App::Cmd::Command|App::Cmd::Command> for |
79
|
|
|
|
|
|
|
L<MooseX::App::Cmd::Command|MooseX::App::Cmd::Command>. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Then you can write your moose commands as Moose classes, with |
82
|
|
|
|
|
|
|
L<MooseX::Getopt|MooseX::Getopt> |
83
|
|
|
|
|
|
|
defining the options for you instead of C<opt_spec> returning a |
84
|
|
|
|
|
|
|
L<Getopt::Long::Descriptive|Getopt::Long::Descriptive> spec. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 METHODS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 BUILD |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
After calling C<new> this method is automatically run, setting underlying |
91
|
|
|
|
|
|
|
L<App::Cmd|App::Cmd> attributes as per its documentation. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SEE ALSO |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=over |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item L<App::Cmd|App::Cmd> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item L<App::Cmd::Tutorial|App::Cmd::Tutorial> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item L<MooseX::Getopt|MooseX::Getopt> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item L<MooseX::App::Cmd::Command|MooseX::App::Cmd::Command> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SUPPORT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-App-Cmd> |
110
|
|
|
|
|
|
|
(or L<bug-MooseX-App-Cmd@rt.cpan.org|mailto:bug-MooseX-App-Cmd@rt.cpan.org>). |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
113
|
|
|
|
|
|
|
L<http://lists.perl.org/list/moose.html>. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
116
|
|
|
|
|
|
|
L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 AUTHOR |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=for stopwords Mark Gardner Karen Etheridge Graham Knop Daisuke Maki Offer Kaye brunov Ken Crowell vovkasm Dann Guillermo Roditi Michael Joyce |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=over 4 |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item * |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Mark Gardner <mjgardner@cpan.org> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item * |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item * |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Graham Knop <haarg@haarg.org> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item * |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Daisuke Maki <dmaki@cpan.org> |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Offer Kaye <offer.kaye@gmail.com> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
brunov <vecchi.b@gmail.com> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Ken Crowell <oeuftete@gmail.com> |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
vovkasm <vovkasm@gmail.com> |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item * |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Dann <techmemo@gmail.com> |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item * |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Guillermo Roditi <groditi@gmail.com> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item * |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Michael Joyce <ubermichael@gmail.com> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=back |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Infinity Interactive, Inc. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
179
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |