Maroš Kollár > MooseX-App-1.28 > MooseX::App::Meta::Role::Attribute::Option

Download:
MooseX-App-1.28.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: MooseX-App-1.30

NAME ^

MooseX::App::Meta::Role::Attribute::Option - Meta attribute role for options

DESCRIPTION ^

This meta attribute role will automatically be applied to all attributes that should be used as options.

ACCESSORS ^

In your app and command classes you can use the following attributes in option or parameter definitions.

 option 'myoption' => (
     is                 => 'rw',
     isa                => 'ArrayRef[Str]',
     documentation      => 'My special option',
     cmd_flag           => 'myopt',
     cmd_aliases        => [qw(mopt localopt)],
     cmd_tags           => [qw(Important!)],
     cmd_position       => 1,
     cmd_split          => qr/,/,
 );

cmd_flag

Use this name instead of the attribute name as the option name

cmd_type

Option to mark if this attribute should be used as an option or parameter value.

Allowed values are:

cmd_aliases

Arrayref of alternative option names

cmd_tags

Extra option tags displayed in the usage information (in brackets)

cmd_position

Override the order of the parameters in the usage message.

cmd_split

Splits multiple values at the given separator string or regular expression. Only works in conjunction with an 'ArrayRef[*]' type constraint (isa).

METHODS ^

These methods are only of interest to plugin authors.

cmd_name_possible

 my @names = $attribute->cmd_name_possible();

Returns a list of all possible option names.

cmd_name_primary

 my $name = $attribute->cmd_name_primary();

Returns the primary option name

cmd_usage_name

 my $name = $attribute->cmd_usage_name();

Returns the name as used by the usage text

cmd_usage_description

 my $name = $attribute->cmd_usage_description();

Returns the description as used by the usage text

cmd_tags_list

 my @tags = $attribute->cmd_tags_list();

Returns a list of tags

cmd_is_bool

 my $bool = $attribute->cmd_is_bool();

Returns true, false or undef depending on the type constraint and default of the attribute:

syntax highlighting: