1MouseX::App::Cmd(3) User Contributed Perl Documentation MouseX::App::Cmd(3)
2
3
4
6 MouseX::App::Cmd - Mashes up MouseX::Getopt and App::Cmd
7
9 version 0.30
10
12 package YourApp::Cmd;
13 use Mouse;
14
15 extends qw(MouseX::App::Cmd);
16
17
18 package YourApp::Cmd::Command::blort;
19 use Mouse;
20
21 extends qw(MouseX::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 MouseX::Getopt.
53
54 Use it like App::Cmd advises (especially see App::Cmd::Tutorial),
55 swapping App::Cmd::Command for MouseX::App::Cmd::Command.
56
57 Then you can write your moose commands as Mouse classes, with
58 MouseX::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 MouseX::Getopt
70 MouseX::App::Cmd::Command
71
73 יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
74
76 This software is copyright (c) 2008 by Infinity Interactive, Inc..
77
78 This is free software; you can redistribute it and/or modify it under
79 the same terms as the Perl 5 programming language system itself.
80
82 · Mark Gardner <mjgardner@cpan.org>
83
84 · Mark Gardner <gardnerm@gsicommerce.com>
85
86 · Karen Etheridge <ether@cpan.org>
87
88 · Yuval Kogman <nothingmuch@woobling.org>
89
90 · Graham Knop <haarg@haarg.org>
91
92 · Daisuke Maki <dmaki@cpan.org>
93
94 · Offer Kaye <offer.kaye@gmail.com>
95
96 · vovkasm <vovkasm@gmail.com>
97
98 · Ken Crowell <oeuftete@gmail.com>
99
100 · brunov <vecchi.b@gmail.com>
101
102 · Mark Gardner <mjg+github@phoenixtrap.com>
103
104 · Guillermo Roditi <groditi@gmail.com>
105
106 · Dann <techmemo@gmail.com>
107
108 · Michael Joyce <ubermichael@gmail.com>
109
110
111
112perl v5.30.1 2020-01-30 MouseX::App::Cmd(3)