---
name: "MooseX::App::Meta::Role::Class::Base"
section: "3pm"
platform: "linux"
package: "libmoosex-app-perl"
version: "1.43-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/MooseX::App::Meta::Role::Class::Base"
---

# MooseX::App::Meta::Role::Class::Base(3pm)

Meta class role for application base class

## NAME

MooseX::App::Meta::Role::Class::Base - Meta class role for application base class

## DESCRIPTION

This meta class role will automatically be applied to the application base class. This documentation is only of interest if you intend to write plugins for MooseX-App.

## ACCESSORS

### app\_messageclass

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

### app\_namespace

Usually MooseX::App will take the package name of the base class as the namespace for commands. This namespace can be changed.

### app\_exclude

Exclude namespaces included in app\_namespace

### app\_base

Usually MooseX::App will take the name of the calling wrapper script to construct the program name in various help messages. This name can be changed via the app\_base accessor. Defaults to the base name of `$0`

### app\_fuzzy

Boolean flag that controls if command names and attributes should be matched exactly or fuzzy. Defaults to true.

### app\_command\_name

Coderef attribute that controls how package names are translated to command names and attributes. Defaults to &MooseX::App::Utils::class\_to\_command

### app\_commands

Hashref with command to command class map.

### app\_strict

Boolean flag that controls if an application with superfluous/unknown positional parameters should terminate with an error message or not. If disabled all extra parameters will be copied to the extra\_argv command class attribute.

### app\_prefer\_commandline

By default, arguments passed to new\_with\_command and new\_with\_options have a higher priority than the command line options. This boolean flag will give the command line an higher priority.

### app\_permute

Boolean flag that controls if command line arguments that take multiple values (ie ArrayRef or HashRef type constraints) can be permuted.

## METHODS

### command\_check

Runs sanity checks on options and parameters. Will usually only be executed if either HARNESS\_ACTIVE or APP\_DEVELOPER environment are set.

### command\_register

```
 $self->command_register($command_moniker,$command_class);
```

Registers an additional command

### command\_get

```
 my $command_class = $self->command_register($command_moniker);
```

Returns a command class for the given command moniker

### command\_class\_to\_command

```
 my $command_moniker = $meta->command_class_to_command($command_class);
```

Returns the command moniker for the given command class.

### command\_message

```
 my $message = $meta->command_message(
    header  => $header,
    type    => 'error',
    body    => $message
 );
```

Generates a message object (using the class from app\_messageclass)

### command\_usage\_attributes

```
 my @attributes = $meta->command_usage_attributes($metaclass);
```

Returns a list of attributes/command options for the given meta class.

### command\_usage\_command

```
 my @messages = $meta->command_usage_command($command_metaclass);
```

Returns a list of messages containing the documentation for a given command meta class.

### command\_usage\_description

```
 my $message = $meta->command_usage_description($command_metaclass);
```

Returns a messages with the basic command description.

### command\_usage\_global

```
 my @messages = $meta->command_usage_global();
```

Returns a list of messages containing the documentation for the application.

### command\_usage\_header

```
 my $message = $meta->command_usage_header();
 my $message = $meta->command_usage_header($command_meta_class);
```

Returns a message containing the basic usage documentation

### command\_find

```
 my @commands = $meta->command_find($commands_arrayref);
```

Returns a list of command names matching the user input

### command\_candidates

```
 my $commands = $meta->command_candidates($user_command_input);
```

Returns either a single command or an arrayref of possibly matching commands.

### command\_proto

```
 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.

### command\_args

```
 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.

### command\_parse\_options

```
 my ($options,$errors) = $self->command_parse_options(\@attribute_metaclasses);
```

Tries to parse the selected attributes from `@ARGV`.

### command\_scan\_namespace

```
 my %namespaces = $self->command_scan_namespace($namespace);
```

Scans a namespace for command classes. Returns a hash with command names as keys and package names as values.

### command\_process\_attribute

```
 my @attributes = $self->command_process_attribute($attribute_metaclass,$matches);
```

TODO ###Returns a list of all attributes with the given type

### command\_usage\_options

```
 my $usage = $self->command_usage_options($metaclass,$headline);
```

Returns the options usage as a message object

### command\_usage\_parameters

```
 my $usage = $self->command_usage_parameters($metaclass,$headline);
```

Returns the positional parameters usage as a message object

### command\_check\_attributes

```
 $errors = $self->command_check_attributes($command_metaclass,$errors,$params)
```

Checks all attributes. Returns/alters the `$errors` arrayref

### command\_parser\_hints

```
 $self->command_parser_hints($self,$metaclass)
```

Generates parser hints as required by MooseX::App::ParsedArgv
