NAME
MooX::Cmd - Giving an easy Moo style way to make command organized CLI apps
VERSION
version 0.002
SYNOPSIS
package MyApp;
use Moo;
use MooX::Cmd;
sub execute {
my ( $self, $args_ref, $chain_ref ) = @_;
my @extra_argv = @{$args_ref};
my @chain = @{$chain_ref} # in this case only ( $myapp )
# where $myapp == $self
}
1;
package MyApp::Cmd::Command;
# for "myapp command"
use Moo;
use MooX::Cmd;
# gets executed on "myapp command" but not on "myapp command command"
# there MyApp::Cmd::Command still gets instantiated and for the chain
sub execute {
my ( $self, $args_ref, $chain_ref ) = @_;
my @chain = @{$chain_ref} # in this case ( $myapp, $myapp_cmd_command )
# where $myapp_cmd_command == $self
}
1;
package MyApp::Cmd::Command::Cmd::Command;
# for "myapp command command"
use Moo;
use MooX::Cmd;
# gets executed on "myapp command command" and will not get instantiated
# on "myapp command" cause it doesnt appear in the chain there
sub execute {
my ( $self, $args_ref, $chain_ref ) = @_;
my @chain = @{$chain_ref} # in this case ( $myapp, $myapp_cmd_command,
# $myapp_cmd_command_cmd_command )
# where $myapp_cmd_command_cmd_command == $self
}
1;
DESCRIPTION
Works together with MooX::Options for every command on its own, so options are parsed for the specific context and used for the instantiation:
myapp --argformyapp command --argformyappcmdcommand ...
SUPPORT
Repository
http://github.com/Getty/p5-moox-cmd
Pull request and additional contributors are welcome
Issue Tracker
http://github.com/Getty/p5-moox-cmd/issues
AUTHOR
Torsten Raudssus <torsten@raudss.us>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.