Getopt...AutoMap(3pm)

πŸ“¦ version 2.000011, in ubuntu stonking

πŸ’– NAME πŸ’–

Getopt::Yath::Option::AutoMap β€” it's the option type that takes all the values you throw at it, but also has a lil default ready to go if you show up with nothing. Bestie, it's giving "I can do both" energy. 🫢


🌸 DESCRIPTION 🌸

Okay so picture this: this bad boy is a mashup of the 'Auto' type and the 'Map' type. The no-arg form --opt will add the default key+value pairs straight into the hash β€” no input needed, it just knows. ✨

Then the --opt=KEY=VAL form comes through and adds additional values on top.

So basically: silence gets you the defaults, and speaking up gets you defaults plus your stuff. Iconic behavior tbh. πŸ‘‘


πŸŽ€ 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',
    autofill       => sub { +{ HOME => $ENV{HOME}, USER => $ENV{USER} } },
);

πŸ¦‹ METHODS πŸ¦‹

Every single method from Getopt::Yath::Option::Map is inherited, no cap. These ones below are either overridden or just lowkey worth calling out:

  • requires_arg: false β€” nope, you do not have to hand it an argument. It's fine on its own. πŸ’…
  • allows_autofill: true β€” yes queen, autofill is permitted.
  • requires_autofill: true β€” and actually it's not just permitted, it's required bestie.

And here's the tea β˜• on how those play out:

  • --opt adds the autofill key/value pairs. All by itself. So brave. πŸ₯Ή
  • --opt=KEY=VAL adds a specific pair instead.

🌈 SOURCE 🌈

The source code repository for Getopt-Yath lives right here, come thru:

<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. Periodt.

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


okay that's the whole page bestie, you ate that πŸ’…βœ¨

That's a wrap on Getopt...AutoMap(3pm) from perl v5.40.1, dated 2026-05-10 β€” see you in the next manpage, mwah πŸ«ΆπŸ’–

πŸ“¦ where this page comes from