1MooseX::App::Simple(3)User Contributed Perl DocumentationMooseX::App::Simple(3)
2
3
4

NAME

6       MooseX::App::Simple - Single command applications
7

SYNOPSIS

9         package MyApp;
10         use MooseX::App::Simple qw(Config Color);
11
12         parameter 'param' => (
13             is            => 'rw',
14             isa           => 'Str',
15             documentation => q[First parameter],
16             required      => 1,
17         ); # Positional parameter
18
19         option 'my_option' => (
20             is            => 'rw',
21             isa           => 'Bool',
22             documentation => q[Enable this to do fancy stuff],
23         ); # Option (--my_option)
24
25         has 'private' => (
26             is              => 'rw',
27         ); # not exposed
28
29         sub run {
30             my ($self) = @_;
31             # Do something
32         }
33
34       And then in some simple wrapper script:
35
36        #!/usr/bin/env perl
37        use MyApp;
38        MyApp->new_with_options->run;
39

DESCRIPTION

41       MooseX-App-Simple works basically just as MooseX::App, however it does
42       not search for commands and assumes that you have all options and
43       parameters defined in the current class.
44
45       Read the Tutorial for getting started with a simple MooseX::App command
46       line application.
47

METHODS

49   new_with_options
50        my $myapp_command = MyApp->new_with_options();
51
52       This method reads the command line arguments from the user and tries to
53       create instantiate the current class with the ARGV-input. If it fails
54       it returns a MooseX::App::Message::Envelope object holding an error
55       message.
56
57       You can pass a hash or hashref of default params to new_with_options
58
59        MyApp->new_with_options( %default );
60
61       Optionally you can pass a custom ARGV to this constructor
62
63        my $obj = MyApp->new_with_options( ARGV => \@myARGV );
64
65       However, if you do so you must take care of propper @ARGV encoding
66       yourself.
67

OPTIONS

69       Same as in MooseX::App
70

PLUGINS

72       Same as in MooseX::App. However plugings adding commands (eg. version)
73       will not work with MooseX::App::Simple.
74

SEE ALSO

76       Read the Tutorial for getting started with a simple MooseX::App command
77       line application.
78
79       See MooseX::Getopt and MooX::Options for alternatives
80
81
82
83perl v5.30.0                      2019-07-26            MooseX::App::Simple(3)
Impressum