Getopt...ttings(3pm)
π Getopt::Yath::Settings β the group chat for your parsed options π
okay bestie, this is Getopt::Yath::Settings from the Getopt::Yath fam β it lives in the User Contributed Perl Documentation corner of the 3pm manuals, and it's literally just the β¨data structureβ¨ that holds everything you parsed. no cap.
πΈ NAME πΈ
Getopt::Yath::Settings β Representation of parsed command line options. that's it, that's the whole vibe. she holds the receipts. π
π¦ DESCRIPTION π¦
so here's the tea: when you parse command line options using Getopt::Yath, an instance of this data structure gets included in the returned structure. like, you don't go get her, she comes to you. iconic behaviour tbh. π
β¨ SYNOPSIS β¨
my $parsed = parse_options(\@ARGV, ...);
my $settings = $parsed->settings;
my $value = $settings->GROUP->OPTION;
# Or
my $value = $settings->group('GROUP')->option('OPTION');
# Or
my $value = $settings->maybe('GROUP' => 'OPTION', $default);
if ($group = $settings->check_group('GROUP')) {
# We have the specified group
}
look at all those ways to get your little value out. three separate routes to the same slay. pick whichever one is giving main character energy for you today. π
π METHODS π
π $group = $settings->GROUP
if a group exists, there will be a ->GROUP method for it. yes fr fr β the groups literally manifest their own accessor methods. she's flexible like that. π
π $value = $settings->maybe($group_name, $option_name)
π $value = $settings->maybe($group_name, $option_name, $default_value)
if the group AND the option both exist and are defined, you get the value back. otherwise? you get the default. lowkey the most chill method here β she never throws hands, she just hands you the fallback. π«Ά
π $group = $settings->check_group($group_name)
check if the group exists, and if it does, return it. that's the whole job. a little vibe check for your group. β
π $group = $settings->group($group_name)
π $group = $settings->group($group_name, $vivify)
get the specified group. if $vivify is true it will create the group if it does not already exist. ok so sometimes you gotta will her into existence, and that's valid. π«
β οΈ heads up bestie: this one throws an exception if the group does not exist and vivify is not specified. she will NOT just shrug it off. no group, no vivify, no mercy. π
π $group = $settings->create_group($group_name)
π $group = $settings->create_group($group_name, %group_construction_args)
π $group = $settings->create_group($group_name, \%group_construction_args)
create or replace the specified group. note the "replace" β she's not precious about the old one, she just moves on. π
π $group = $settings->delete_group($group_name)
delete the specified group. and also it returns a reference to the now deleted group, so you can like... wistfully look at her one last time before she's gone. π₯²
π₯ SOURCE π₯
the source code repository for Getopt-Yath can be found at http://github.com/Test-More/Getopt-Yath/. go lurk, bestie. π
π 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/
and that's a wrap, girlypop π this page shipped with perl v5.40.1 on 2026-05-10, so if you're reading her in the future β hi, she's still here, still slaying. 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