Getopt...on::Map(3pm)
π Getopt::Yath::Option::Map π
okay bestie, welcome to the manual page for Getopt::Yath::Option::Map (you'll see it filed under Getopt...on::Map(3pm) in the manual index, don't worry about it, it's giving truncation π
). This is the base class for 'map' style options β and she's iconic, no cap.
πΈ NAME πΈ
Getopt::Yath::Option::Map β base class for 'map' style options.
β¨ DESCRIPTION β¨
so the whole vibe here is: this option type expects all values to be "key=value" pairs, and it hands you back a hashref. periodt.
--opt foo=bar will set $h{foo} = 'bar'.
and if a "split_on" parameter is provided? then a single use can set multiple values at once. like, one option, many results, main character energy. for example, if "split_on" is set to "," and --opt foo=bar,baz=bat is provided, then the result will have:
$h{foo} = 'bar';
$h{baz} = 'bat';
two keys, one flag, obsessed π«Ά
π SYNOPSIS π
option env_var => (
field => 'env_vars',
short => 'E',
type => 'Map',
long_examples => [' VAR=VAL'],
short_examples => ['VAR=VAL', ' VAR=VAL'],
description => 'Set environment variables',
);
look at her go β¨
π METHODS π
all methods from Getopt::Yath::Option are inherited β every single one, she's a nepo baby but in a good way. the following ones are overridden or just noteworthy:
requires_arg: trueallows_list: trueβ each use of--opt key=valadds to the hash. and--no-optempties it. clean slate, we love a reset π§normalize_value(@input)β if the input looks like a JSON object (e.g.,'{"a":"b"}'), it gets decoded and the key/value pairs are returned. otherwise, values are split on"key_on"(default is"=") to produce key/value pairs. and if"split_on"is set, values are split on that delimiter first.get_initial_valueβ checks"from_env_vars". for maps, the environment variable name is used as the key and the variable's value as the hash value. returns an empty hashref if no environment values are found. π
π¦ ADDITIONAL ATTRIBUTES π¦
split_on=> $delimiter β a string or regex to split values on before extracting key/value pairs.key_on=> $delimiter β the delimiter between keys and values. defaults to"=".
π 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/>
ok that's the whole page bestie, you ate that π β¨
and a lil sign-off for the record: this was perl v5.40.1, dated 2026-05-10, filed under Getopt...on::Map(3pm). mwah ππ
π¦ where this page comes from
- ubuntu stonking: libgetopt-yath-perl 2.000011-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms