
However, if you do so you must take care of propper encoding yourself. Optionally you can pass a custom ARGV to this constructor my $obj = MyApp->new_with_command( ARGV => ) You can pass a hash of default/fallback params to new_with_command my $obj = MyApp->new_with_command(%default) If it fails it returns a MooseX::App::Message::Envelope object holding an error message. This constructor reads the command line arguments and tries to create a command class instance. METHODS new_with_command my $myapp_command = MyApp->new_with_command() Read the Tutorial for getting started with a simple MooseX::App command line application. HashRef: Specify multiple key value pairs ('-opt key=value -opt key2=value2', also see app_permute) The following type constraints are supported:ĪrrayRef: Specify multiple values ('-opt value1 -opt value2', also see app_permute and cmd_split)

Moose type constraints help MooseX::App to construct helpful error messages and parse in a meaningful way. Positional parameters are defined with the 'parameter' keyword parameter 'some_option' => (Īll keywords are imported by Moosex::App (in the app base class) and MooseX::App::Command (in the command class) or MooseX::App::Simple (single class application).įurthermore, all options and parameters can also be supplied via %ENV option 'some_option' => (Ĭmd_env => 'SOME_OPTION', # sets the env key However such options must have a Boolean type constraint. Single letter options are treated as flags and may be combined with each other. Traits =>, # Load extra metaclassĬmd_type => 'option', # Set attribute type This is equivalent to has 'some_option' => ( Provide helpful error messages if user input cannot be validated (either missing or wrong attributes or Moose type constraints not satisfied) or if the user requests help.Ĭommandline options are defined using the 'option' keyword which accepts the same attributes as Moose' 'has' keyword.

Read, encode and validate the command line options and positional parameters entered by the user from and %ENV (and possibly prompt the user for additional parameters see MooseX::App::Plugin::Term) Options and positional parameters can be defined as simple Moose accessors using the option and parameter keywords respectively.įind, load and initialise the command classes (see MooseX::App::Simple for single class/command applications)Ĭreate automated help and documentation from modules POD as well as attributes metadata and type constraints ) ) and create one class for each command in an underlying namespace. Just take any existing Moose class, add a single line ( use MooseX-App qw(PluginA PluginB. MooseX-App is a highly customisable helper to write user-friendly command line applications without having to worry about most of the annoying things usually involved. help -usage -? Prints this usage information. Some_parameter Some parameter that you need to supply Īnother_command Description of another command global_option Enable this to do fancy stuff Use MooseX::App::Command # important (also imports Moose)Įxtends qw(MyApp) # optional, only if you want to use global options from base classĪnd then you need a simple wrapper script (called eg.

Packackes in the namespace may be deeply nested. Write multiple command classes (If you have only a single command class you should use MooseX::App::Simple instead). For example, a parameter sweep of an S-parameter analysis.MooseX::App - Write user-friendly command line apps with even less suffering SYNOPSISĭocumentation => q, However, it can be used to swap the orders of the independent, even if the dependent is a matrix. The permute() function cannot be used to swap the rows and columns of a matrix.

The permute() function can be used for this purpose. To swap the order so that it can be easily plotted, the order of the independents must be swapped. For example, a data could have two independent variables in a particular order. The permute() function is used to swap the order of the independent variables that are attached to a data variable. Any N-dimensional square data (all inner independents must have the same value N)Īny permutation vector of the numbers 1 through N †
