GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  MOOSEX::APP::META::ROLE::ATTRIBUTE::OPTION (3)

.ds Aq ’

NAME

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

CONTENTS

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_env            => MY_OPTION,
     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:
o option - Command line option
o proto - Command line option that should be processed prior to other options (eg. a config-file option that sets other attribues) Usually only used for plugin developmemt
o parameter - Positional parameter command line value

    cmd_env

Environment variable name (only uppercase letters, numeric and underscores allowed). If variable was not specified otherwise the value will be taken from %ENV.

    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). ie. ’--myattr value1,value2’ with cmd_split set to ’,’ would produce an arrayref with to elements.

    cmd_count

Similar to the Getopt::Long ’+’ modifier, cmd_count turns the attribute into a counter. Every occurence of the attribute in @ARGV (without any value) would increment the resulting value by one

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_has_value



 my $has_value = $attribute->cmd_has_value();



Indicates if an commandline attribute has a value. Usually attributes with a boolean type constraint or counters don’t have values.
o undef: Does not have a boolean type constraint
o true: Has a boolean type constraint
o false: Has a boolean type constraint, and a true default value

    cmd_type_constraint_check



 $attribute->cmd_type_constraint_check($value)



Checks the type constraint. Returns an error message if the check fails

    cmd_type_constraint_description



 $attribute->cmd_type_constraint_description($type_constraint,$singular)



Creates a description of the selected type constraint.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 MOOSEX::APP::META::ROLE::ATTRIBUTE::OPTION (3) 2016-02-20

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.