Getopt::Yath::Option::BoolMap(3)

NAME
Getopt::Yath::Option::BoolMap - Options that take multiple boolean values.

DESCRIPTION
Match several --OPTION-XXX and --no-OPTION-XXX options based on a given regex, populates a hashref where each option found is given a true or false value depending on if it has the --no- prefix.

SYNOPSIS
    option features => (
        type => 'BoolMap',

        clear => sub { {features => 0} },
        pattern => qr/feature-(.+)/,

        description => 'Match '--feature-(foo), --no-feature-(foo), etc and set {foo => $BOOL} in the 'features' option',
    );

METHODS
All methods from Getopt::Yath::Option::Map are inherited. The following are overridden or noteworthy:

requires_arg
    Depends on the value of the "requires_arg" attribute. Defaults to false.

custom_matches
    Returns a coderef that matches command-line arguments against the "pattern" regex. When "--MATCH" is used the key gets a true value; when "--no-MATCH" is used it gets a false value.

no_arg_value
    Returns the option's field name with a value of 1.

ADDITIONAL ATTRIBUTES

pattern => qr/.../
    Required. A regex pattern (with a capture group) that is embedded into "qr/^--(no-)?$pattern$/". The first capture group from the pattern is used as the hash key.

requires_arg => BOOL
    If true, the option requires an argument. Defaults to false.

custom_matches => sub { ... }
    Optional coderef to override the default matching logic. Receives the option object, the input string, and the parse state.

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/>