DESCRIPTION

This is a role which provides an alternate constructor for creating objects using parameters passed in from the command line.

This module attempts to DWIM as much as possible with the command line params by introspecting your class's attributes. It will use the name of your attribute as the command line option, and if there is a type constraint defined, it will configure Getopt::Long to handle the option accordingly.

By default, attributes which start with an underscore are not given commandline argument support, unless the attribute's metaclass is set to MouseX::Getopt::Meta::Attribute. If you don't want your accessors to have the leading underscore in their name, you can do this:

For example, if you had the same custom ArrayOfInts subtype from the examples above, but did not add a new custom option type for it to the OptionTypeMap, it would be treated just like a normal ArrayRef type for Getopt purposes (that is, =s@).

new_with_options (%params)

This method will take a set of default %params and then collect params from the command line (possibly overriding those in %params) and then return a newly constructed object.

The special parameter argv, if specified should point to an array reference with an array to use instead of @ARGV.

If Getopt::Long::Descriptive is installed and any of the following command line params are passed, the program will exit with usage information (and the option's state will be stored in the help_flag attribute). You can add descriptions for each option by including a documentation option for each attribute to document.