1MooseX::App::Cmd(3pm) User Contributed Perl DocumentationMooseX::App::Cmd(3pm)
2
3
4
6 MooseX::App::Cmd - Mashes up MooseX::Getopt and App::Cmd
7
9 version 0.32
10
12 package YourApp::Cmd;
13 use Moose;
14
15 extends qw(MooseX::App::Cmd);
16
17
18 package YourApp::Cmd::Command::blort;
19 use Moose;
20
21 extends qw(MooseX::App::Cmd::Command);
22
23 has blortex => (
24 traits => [qw(Getopt)],
25 isa => 'Bool',
26 is => 'rw',
27 cmd_aliases => 'X',
28 documentation => 'use the blortext algorithm',
29 );
30
31 has recheck => (
32 traits => [qw(Getopt)],
33 isa => 'Bool',
34 is => 'rw',
35 cmd_aliases => 'r',
36 documentation => 'recheck all results',
37 );
38
39 sub execute {
40 my ( $self, $opt, $args ) = @_;
41
42 # you may ignore $opt, it's in the attributes anyway
43
44 my $result = $self->blortex ? blortex() : blort();
45
46 recheck($result) if $self->recheck;
47
48 print $result;
49 }
50
52 This module marries App::Cmd with MooseX::Getopt.
53
54 Use it like App::Cmd advises (especially see App::Cmd::Tutorial),
55 swapping App::Cmd::Command for MooseX::App::Cmd::Command.
56
57 Then you can write your moose commands as Moose classes, with
58 MooseX::Getopt defining the options for you instead of "opt_spec"
59 returning a Getopt::Long::Descriptive spec.
60
62 BUILD
63 After calling "new" this method is automatically run, setting
64 underlying App::Cmd attributes as per its documentation.
65
67 App::Cmd
68 App::Cmd::Tutorial
69 MooseX::Getopt
70 MooseX::App::Cmd::Command
71
73 Bugs may be submitted through the RT bug tracker
74 <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-App-Cmd> (or
75 bug-MooseX-App-Cmd@rt.cpan.org <mailto:bug-MooseX-App-
76 Cmd@rt.cpan.org>).
77
78 There is also a mailing list available for users of this distribution,
79 at http://lists.perl.org/list/moose.html.
80
81 There is also an irc channel available for users of this distribution,
82 at irc://irc.perl.org/#moose.
83
85 XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org>
86
88 · Mark Gardner <mjgardner@cpan.org>
89
90 · Karen Etheridge <ether@cpan.org>
91
92 · Graham Knop <haarg@haarg.org>
93
94 · Daisuke Maki <dmaki@cpan.org>
95
96 · Offer Kaye <offer.kaye@gmail.com>
97
98 · brunov <vecchi.b@gmail.com>
99
100 · vovkasm <vovkasm@gmail.com>
101
102 · Ken Crowell <oeuftete@gmail.com>
103
104 · Michael Joyce <ubermichael@gmail.com>
105
106 · Dann <techmemo@gmail.com>
107
108 · Guillermo Roditi <groditi@gmail.com>
109
111 This software is copyright (c) 2008 by Infinity Interactive, Inc..
112
113 This is free software; you can redistribute it and/or modify it under
114 the same terms as the Perl 5 programming language system itself.
115
116
117
118perl v5.28.1 2015-09-12 MooseX::App::Cmd(3pm)