Getopt::Yath::Instance(3pm)

NAME
Getopt::Yath::Instance - An instance of options.

DESCRIPTION
This does the real work for Getopt::Yath under the hood. It is probably better not to use this directly.

SYNOPSIS
Do not use this directly. The user interface you should be looking at is Getopt::Yath.

METHODS

$state = $instance->process_args(\@argv, %params)
    Parse the given argument list according to the defined options. Returns a Getopt::Yath::State object containing "settings", "skipped", "remains", "stop", "cleared", "modules", and "env" accessors. See Getopt::Yath for the full list of parameters and Getopt::Yath::State for the returned object.

$option = $instance->add_option(%option_spec)
    Add a new option to this instance. The %option_spec is passed directly to "create" in Getopt::Yath::Option.

$instance->add_post_process($weight, $applicable, $callback)
    Register a post-processing callback. $weight controls ordering (lower runs first), $applicable is an optional coderef filter, and $callback is the coderef to run after parsing.

$instance->include($other_instance)
$instance->include($other_instance, \@list)
    Merge options and post-processors from another instance into this one. If "\@list" is provided, only options whose title, field, or name appears in the list are included.

$text = $instance->docs($format, %params)
    Generate documentation for all applicable options. $format must be 'cli' or 'pod'. Params may include:

    head => $level
        Heading level for POD output (e.g., 2 for "=head2").

    group => $group_name
        Only show options from the specified group.

    settings => $settings
        An Getopt::Yath::Settings object used to evaluate option applicability.

    applicable => $bool
        If true, include all options regardless of their applicability filter.

    color => $bool
        Enable or disable ANSI color in CLI output. Defaults to true if color is available and STDOUT is a terminal.

$map = $instance->option_map()
$map = $instance->option_map(\@options)
    Returns a hashref mapping all option forms (e.g., "--verbose", "-v", "--no-verbose") to their Getopt::Yath::Option objects. Also includes a "custom_match" key with an arrayref of custom match coderefs. Results are cached unless an explicit option list is provided.

$groups = $instance->option_groups()
    Returns a hashref of group names defined by the current options. Results are cached.

$bool = $instance->have_group($name)
    Returns true if any option defines the given group name.

$instance->set_category_sort_map(%map)
    Set the sort ordering for documentation categories. See "category_sort_map" in Getopt::Yath.

$options = $instance->options()
    Returns the arrayref of Getopt::Yath::Option objects registered in this instance.

SOURCE
The source code repository for Getopt-Yath can be found at <http://github.com/Test-More/Getopt-Yath/>.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS
Chad Granum <exodist@cpan.org>

COPYRIGHT
Copyright Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See <http://dev.perl.org/licenses/>