NAME
Getopt::Yath::State - Representation of the result of parsing command-line options.
DESCRIPTION
This object is returned by "parse_options" in Getopt::Yath (and "process_args" in Getopt::Yath::Instance). It holds the parsed settings, any skipped or remaining arguments, the stop token (if any), environment variable changes, cleared options, and the modules whose options were used.
This object is a blessed hash, so hash-key access (e.g., $state->{settings}) continues to work for backwards compatibility. However, accessor methods are preferred.
SYNOPSIS
my $state = parse_options(\@ARGV, stops => ['--']);
my $settings = $state->settings; # Getopt::Yath::Settings object
my $remains = $state->remains; # args after a stop token
my $skipped = $state->skipped; # skipped non-options
my $stop = $state->stop; # what token stopped parsing
my $env = $state->env; # env vars that were/would be set
my $cleared = $state->cleared; # options cleared via --no-opt
my $modules = $state->modules; # modules whose options were used
METHODS
- $settings = $state->settings
-
Returns the Getopt::Yath::Settings object containing all parsed option values organized by group.
- $arrayref = $state->skipped
-
Returns an arrayref of arguments that were skipped during parsing (when
skip_non_optsorskip_invalid_optsis enabled). - $arrayref = $state->remains
-
Returns an arrayref of arguments that were not processed, typically those appearing after a stop token such as
--. - $string = $state->stop
- $state->set_stop($token)
-
Returns the token that caused parsing to stop (e.g.,
--,::), orundefif parsing completed normally.set_stopis used internally during parsing. - $hashref = $state->env
-
Returns a hashref of environment variable changes. Keys are variable names, values are what was (or would have been, with
no_set_env) set. A value ofundefmeans the variable was cleared. - $hashref = $state->cleared
-
Returns a hashref tracking which options were explicitly cleared via
--no-opt. Structure is{ group_name => { field_name => 1 } }. - $hashref = $state->modules
-
Returns a hashref of modules whose options were used during parsing. Keys are module names, values are usage counts.
SOURCE
The source code repository for Getopt-Yath can be found at http://github.com/Test-More/Getopt-Yath/.
MAINTAINERS
AUTHORS
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.