Getopt...::Auto(3pm)

πŸ“¦ version 2.000011, in ubuntu stonking

πŸ’– NAME πŸ’–

Getopt::Yath::Option::Auto β€” bestie, this is the option type that comes with default values and still lets you pass an argument. It's giving "have it both ways" and honestly? Iconic. πŸ‘‘

This page lives in the User Contributed Perl Documentation, manual section Getopt...::Auto(3pm), iykyk.


✨ DESCRIPTION ✨

So here's the vibe: this type has an autofill value, and that value gets used when you don't hand the parameter an argument. Like, you just write --opt and it's already got its lil default. Slay. πŸŽ€

But you can also give it a specific value the bougie way, with --opt=val. 🌸

NOT it, though: it DOES NOT support --opt VAL. If you try that, it will most likely result in an exception. Like, the audacity of that syntax? Rejected. πŸ’€ Read the room.

πŸ¦‹ SYNOPSIS πŸ¦‹

option help => (
    type     => 'Auto',
    autofill => 'ALL',    # Default to all if no subtitle
    short    => 'h',

    description    => "Show help, optionally just show a specific subtitle from help output",
    short_examples => ['', '=Subtitle'],
    long_examples  => ['', '=Subtitle'],
);

Look at that. Chef's kiss. 🀌 Every method from Getopt::Yath::Option::Scalar is inherited, and the ones below are either overridden or just too noteworthy to skip.


πŸ’… METHODS πŸ’…

Everything from Getopt::Yath::Option::Scalar gets inherited β€” no cap. But these ones are overridden or noteworthy, and you're gonna wanna know about them:

🌈 requires_arg: false

Nope, it is not over here demanding an argument. That's the whole point, bestie. 🫢

⭐ allows_autofill: true

The autofill glow-up is fully permitted. Yes ma'am.

🌸 requires_autofill: true

Okay so this is the main character rule right here:

  • --opt uses the autofill value. ✨
  • --opt=val uses the provided value. πŸ’–
  • --opt VAL is not supported β€” and btw, the next argument is not consumed. So don't come crying to me when it doesn't go the way you imagined. πŸ™ˆ

πŸ“ can_set_env: true

Environment variables can set this one. Respect. Environment variable girlies stay winning. 🧚


πŸ”₯ SOURCE πŸ”₯

The source code repository for Getopt-Yath can be found at http://github.com/Test-More/Getopt-Yath/. Go be nosy, it's fine, we all do it. πŸ‘€


πŸ‘‘ 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/>


Okay bestie that's the whole page, we ate and left no crumbs. πŸ’… This was Getopt...::Auto(3pm) from perl v5.40.1, dated 2026-05-10 β€” mwah, bye, go write some clean option parsing. πŸ¦‹πŸ’–

πŸ“¦ where this page comes from