MooseX::App::Meta::Role::Class::Base - Meta class role for application base class
This meta class role will automatically be applied to the application base class. This documentation is only of interest if you intent to write plugins for MooseX-App.
Message class for generating error messages. Defaults to MooseX::App::Message::Block. The default can be overwritten by altering the _build_app_messageclass method. Defaults to MooseX::App::Message::Block
_build_app_messageclass
Usually MooseX::App will take the package name of the base class as the namespace for commands. This namespace can be changed.
Usually MooseX::App will take the name of the calling wrapper script to construct the programm name in various help messages. This name can be changed via the app_base accessor. Defaults to the base name of $0
Boolean attribute that controlls if command names and attributes should be matched exactly or fuzzy. Defaults to true.
Coderef attribute that controlls how package names are translated to command names and attributes. Defaults to &MooseX::App::Utils::class_to_command
Hashref with command to command class map.
$self->command_register($command_moniker,$command_class);
Registers an additional command
my $command_class = $self->command_register($command_moniker);
Returns a command class for the given command moniker
my $command_moniker = $meta->command_class_to_command($command_class);
Returns the command moniker for the given command class.
my $message = $meta->command_message( header => $header, type => 'error', body => $message );
Generates a message object (using the class from app_messageclass)
my $message = $meta->command_usage_attributes($metaclass,$headline);
Returns a message object containing the attribute documentation for a given meta class.
my @attributes = $meta->command_usage_attributes($metaclass);
Returns a list of attributes/command options for the given meta class.
my @attributes = $meta->command_usage_attributes_raw($metaclass);
Returns a list of attribute documentations for a given meta class.
my @messages = $meta->command_usage_command($command_metaclass);
Returns a list of messages containing the documentation for a given command meta class.
my $message = $meta->command_usage_description($command_metaclass);
Returns a messages with the basic command description.
my @messages = $meta->command_usage_global();
Returns a list of messages containing the documentation for the application.
my $message = $meta->command_usage_header(); my $message = $meta->command_usage_header($command_meta_class);
Returns a message containing the basic usage documentation
my $commands = $meta->app_commands;
Returns a hashref of command name and command class.
my @commands = $meta->command_find($user_command_input);
Returns a list of command names matching the user input
my $commands = $meta->command_candidates($user_command_input);
Returns either a single command or an arrayref of possibly matching commands.
my ($result,$errors) = $meta->command_proto($command_meta_class);
Returns all parsed options (as hashref) and erros (as arrayref) for the proto command. Is a wrapper around command_parse_options.
my ($options,$errors) = $self->command_args($command_meta_class);
Returns all parsed options (as hashref) and erros (as arrayref) for the main command. Is a wrapper around command_parse_options.
my ($options,$errors) = $self->command_parse_options(\@attribute_metaclasses);
Tries to parse the selected attributes from @ARGV.
my ($error) = $self->command_check_attribute($attribute_meta_class,$value);
Checks if a value is valid for the given attribute. Returns a message object if a validation error occurs.
my ($description) = $self->command_type_constraint_description($type_constraint);
Returns a human-readable type constraint description.
To install MooseX::App, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::App
CPAN shell
perl -MCPAN -e shell install MooseX::App
For more information on module installation, please visit the detailed CPAN module installation guide.