NAME
Getopt::Pad::Spec - The checked spec of one GetOptions call (internal)
DESCRIPTION
This module is internal to Getopt::Pad. It is not part of the public API and can change without notice. Programs use "GetOptions" in Getopt::Pad; this page is for people working on Getopt::Pad itself.
Getopt::Pad::Spec turns the arguments of GetOptions into a tree of checked objects before any command line is looked at. Everything after its construction works with these objects, never with the raw hashes.
Constructing a spec (Getopt::Pad::Spec->new(raw => \%spec)):
takes the
configkey out and builds a Getopt::Pad::Spec::Config from it, and takes theversionkey out;builds the top level as a Getopt::Pad::Spec::Level, which builds its options, args and commands recursively;
attaches the automatic options:
--helpto every level,--versionand--create-completionsto the top level, and with a config block--configand--create-default-configto the top level, marked as inherited;passes every inherited option down to all levels below the level that declares it;
with a config block, refuses a group named
commandson a level with commands, because config files use that key for the command sections.
This module owns the one table of automatic options. Each entry names where the option is attached, its option spec, and its trigger: the code the parser runs when the command line sets the option. Every trigger ends the parse by throwing a Getopt::Pad::ExitRequest that carries the finished output, so no other module needs to know what an automatic option does. --config has no trigger; the parser uses its value to load config files.
METHODS
- root
-
The top level, a Getopt::Pad::Spec::Level.
- config
-
The Getopt::Pad::Spec::Config, or
undefwithout a config block. - version
-
The
versionkey of the spec, orundef. - helperFor($level, %overrides)
-
A Getopt::Pad::Help for
$level. The only place help renderers are created.%overridesare passed to its constructor, for examplehandle => \*STDERR. - CONFIG_OPTION
-
The name of the automatic
--configoption.
SEE ALSO
Getopt::Pad::Spec::Level, Getopt::Pad::Parser
AUTHOR
davenonymous <perl@davenonymous.com>
COPYRIGHT AND LICENSE
Copyright 2026 davenonymous
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.