1MooseX::App::Cmd(3)   User Contributed Perl Documentation  MooseX::App::Cmd(3)
2
3
4

NAME

6       MooseX::App::Cmd - Mashes up MooseX::Getopt and App::Cmd.
7

SYNOPSIS

9       See "SYNOPSIS" in App::Cmd.
10
11           package YourApp::Cmd;
12               use Moose;
13
14           extends qw(MooseX::App::Cmd);
15
16
17
18           package YourApp::Cmd::Command::blort;
19           use Moose;
20
21           extends qw(MooseX::App::Cmd::Command);
22
23           has blortex => (
24               isa => "Bool",
25               is  => "rw",
26               cmd_aliases   => "X",
27               documentation => "use the blortext algorithm",
28           );
29
30           has recheck => (
31               isa => "Bool",
32               is  => "rw",
33               cmd_aliases => "r",
34               documentation => "recheck all results",
35           );
36
37           sub execute {
38               my ( $self, $opt, $args ) = @_;
39
40               # you may ignore $opt, it's in the attributes anyway
41
42               my $result = $self->blortex ? blortex() : blort();
43
44               recheck($result) if $self->recheck;
45
46               print $result;
47           }
48

DESCRIPTION

50       This module marries App::Cmd with MooseX::Getopt.
51
52       Use it like App::Cmd advises (especially see App::Cmd::Tutorial),
53       swapping App::Cmd::Command for MooseX::App::Cmd::Command.
54
55       Then you can write your moose commands as moose classes, with
56       MooseX::Getopt defining the options for you instead of "opt_spec"
57       returning a Getopt::Long::Descriptive spec.
58

AUTHOR

60       Yuval Kogman <nothingmuch@woobling.org>
61
62       With contributions from:
63
64       Guillermo Roditi <groditi@cpan.org>
65
67           Copyright (c) 2007-2008 Infinity Interactive, Yuval Kogman. All rights
68           reserved This program is free software; you can redistribute it and/or
69           modify it under the same terms as Perl itself.
70
71
72
73perl v5.12.0                      2009-09-17               MooseX::App::Cmd(3)
Impressum