Getopt...on::Map(3pm)

πŸ“¦ version 2.000011, in ubuntu stonking

πŸ’– 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: true
  • allows_list: true β€” each use of --opt key=val adds to the hash. and --no-opt empties 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 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