MooseX::App::Cmd::Command - Base class for MooseX::Getopt based App::Cmd::Commands.
use Moose; extends qw(MooseX::App::Cmd::Command); # no need to set opt_spec # see MooseX::Getopt for documentation on how to specify options has option_field => ( isa => "Str", is => "rw", required => 1, ); sub execute { my ( $self, $opts, $args ) = @_; print $self->option_field; # also available in $opts->{option_field} }
This is a replacement base class for App::Cmd::Command classes that includes MooseX::Getopt and the glue to combine the two.
Replaces App::Cmd::Command's argument processing in in favour of MooseX::Getopt based processing.
Full support for Getopt::Long::Descriptive's abilities is not yet written.
This entails taking apart the attributes and getting at the descriptions.
This might actually be added upstream to MooseX::Getopt, so until we decide here's a functional but not very helpful (to the user) version anyway.
To install MooseX::App::Cmd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::App::Cmd
CPAN shell
perl -MCPAN -e shell install MooseX::App::Cmd
For more information on module installation, please visit the detailed CPAN module installation guide.