Getopt...::Auto(3pm)
π 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:
--optuses the autofill value. β¨--opt=valuses the provided value. π--opt VALis 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 π
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
- 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