App-Easer

 view release on metacpan or  search on metacpan

lib/App/Easer/V2.pod  view on Meta::CPAN


When the final sub-command is reached, the I<execute> hook is run.

=back


=head2 Application High Level View

The following list provides all keys/method names that are recognized in
the definition of an application with C<App::Easer::V2>. Items markes as
C<Executable> can be provided as sub references or with overriding the
corresponding method in the derived class.

=over

=item C<aliases>

Array of strings.

The array contains alias names for the command. The first alias is also
considered the C<name> in case a C<name> is missing.

=item C<allow_residual_options>

Boolean, defaults to I<false>.

Signal that the parsing of the command line must not fail if residual,
unrecognized options are found. This allows e.g. building wrappers
around external commands without the need to re-implement all of their
options.

=item C<auto_environment>

Boolean, defaults to I<false>.

Signal that all options without an C<environment> key should get one set
to value 1, triggering auto-generation of the environment variable name.

=item C<children>

Array of items.

Provides a list of children for the command. Children can be provided as
hash references (whose structure is the same as anytyhing supported by
C<hashy_class>), array references (whose first item is the name of a
class and the rest is provided to its C<new> method), a string (which
leads to a class name that can be instantiated without parameters), or a
blessed object.

Anything that does not eventually produce a C<App::Easer::V2::Command>
should be considered a liability.

=item C<children_prefixes>

Array of strings. Defaults to C<[$pkg . '::Cmd']>.

Each string in the array is used as a prefix to look for sub-commands in
C<@INC>.

Assuming the main command is implemented in class C<MyApp>, the default
value looks for classes named C<MyApp::Cmd*>, e.g. C<MyApp::CmdFoo> and
C<MyApp::CmdBar> and I<ignores> classed named C<MyApp::Common> or
C<MyApp::Utils>.

=item C<commit>

Executable with signature:

   sub commit_function ($app) { ... }

where C<$app> is the blessed object for the application.

Perform the I<commit> hook for the application, which is called
immediately after the I<collection> of options for the command and
before looking further down for sub-commands or calling the C<execute>
method. Every weird action like fiddling with the command-line arguments
etc. should be done here.

=item C<default_child>

String. Defaults to C<help>.

The name of a sub-command to invoke if no non-option values are set on
the command line for a non-leaf command.

If set to C<-self>, lack of an explicit child name on the command line
means that the C<execute> of the command itself should be run.

See also C<fallback_to>.

=item C<description>

String.

A verbose form of C<help>, usually providing details about how the
command works. This is used when generating the whole help for the
command.

=item C<environment_prefix>

String.

A prefix that is applied to an options's name to derive an environment
variable name. Used when C<auto_environment> is true and no
C<environment> key is present in the option's specification, or when the
C<environment> key points to value C<1>.

=item C<execute>

Executable.

=item C<fallback_to>

String.

The name of a sub-command to invoke if the first non-option command-line
argument is not recognized as a children command for non-leaf commands.

If set to C<-self>, lack of a valid child name on the command line means
that the C<execute> of the command itself should be run.



( run in 1.673 second using v1.01-cache-2.11-cpan-5837b0d9d2c )