NAME
Getopt::Yath::Option::List - Options that can take multiple values.
DESCRIPTION
Can take multiple values. --opt VAL appends a value to the list. --no-opt will empty the list. If a split_on parameter is provided then a single use can set multiple values. For example if split_on is set to , then --opt foo,bar is provided, then foo and bar will both be added to the list.
SYNOPSIS
option copy_env => (
short => 'e',
type => 'List',
description => "Specify environment variables to pass along with their current values",
long_examples => [ ' HOME', ' SHELL' ],
short_examples => [ ' HOME', ' SHELL' ],
);
METHODS
All methods from Getopt::Yath::Option are inherited. The following are overridden or noteworthy:
- requires_arg: true
- allows_list: true
-
Each use of
--opt VALappends to the list.--no-optempties it. - normalize_value(@input)
-
If the input looks like a JSON array (e.g.,
'["a","b"]'), it is decoded and the elements are returned. Ifsplit_onis set, values are split on that delimiter before normalization. - get_initial_value
-
Checks
from_env_varsfor initial values. Unlike the base class, multiple environment variables can each contribute a value. Returns an empty arrayref if no environment values are found.
ADDITIONAL ATTRIBUTES
- split_on => $delimiter
-
A string or regex to split values on. For example, with
split_on => ',',--opt foo,baradds bothfooandbarto the list.
SOURCE
The source code repository for Getopt-Yath can be found at http://github.com/Test-More/Getopt-Yath/.
MAINTAINERS
AUTHORS
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.