1MooX::Options::Manual::UMsoeorXCCmodn(t3r)ibuted Perl DoMcouomXe:n:tOapttiioonns::Manual::MooXCmd(3)
2
3
4

NAME

6       MooX::Options::Manual::MooXCmd - Manage your tools with MooX::Cmd
7

SYNOPSIS

9         package MyTool;
10
11         use strict; use warnings all => "FATAL";
12
13         use Class::Load qw(load_class);
14         use DBIx::LogAny;
15
16         use Moo;
17         use MooX::Cmd => with_config_from_file; # enable MooX::Cmd driven _build_config_prefixes
18         use MooX::Options => with_config_from_file; # enable --config-files and --config-prefix
19
20         with "MooX::Log::Any";
21
22         option option log_adapter => (is => "ro", required => 1, trigger => 1, json => 1 );
23         option connection => (is => "ro", required => 1, json => 1);
24
25         sub _trigger_log_adapter { my ( $self, $opts ) = @_; load_class("Log::Any::Adapter")->set( @{$opts} ); }
26
27         sub execute {
28             my $self = shift;
29             my $conn = $self->connection;
30             $conn->[3] ||= {};
31             $conn->[3]->{dbix_la_logger} = $self->log;
32             my $dbh = DBIx::LogAny->connect( @{$conn} );
33             ...
34         }
35

DESCRIPTION

37       MooX::Cmd gives you an easy way to organize your tools into many
38       subcommands.
39
40       We can take 'git' as a example.
41
42         git checkout [params]
43         git commit [params]
44
45       MooX::ConfigFromFile gives one a more easy way to configure recurring
46       or complex parameters.  "MooX::ConfigFromFile" finds and loads several
47       configuration files based on your setup. Please read
48       MooX::ConfigFromFile::Role carefully to learn which files from which
49       location are loaded and how this can tuned.
50
51       MooX::Options plays natively with these tools and they do with
52       "MooX::Options".
53
54         $ cat bin/mytool
55         #!/opt/myprj/bin/perl
56
57         use strict; use warnings all => "FATAL";
58
59         use MyTool;
60
61         MyTool->new_with_cmd->execute
62
63       "MooX::Options" improves the help message to display automatically the
64       subcommands.
65

SEE ALSO

67       MooX::Options
68
69       MooX::Cmd
70
71       MooX::ConfigFromFile
72
73       MooX::Log::Any
74

AUTHOR

76       celogeek <me@celogeek.com>
77
79       This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
80
81       This software is copyright (c) 2017 by Jens Rehsack.
82
83       This is free software; you can redistribute it and/or modify it under
84       the same terms as the Perl 5 programming language system itself.
85
86
87
88perl v5.32.0                      2020-07-28 MooX::Options::Manual::MooXCmd(3)
Impressum