Provided by: libgetopt-complete-perl_0.26-4_all
NAME
Getopt::Complete::Args - a set of option/value pairs
VERSION
This document describes Getopt::Complete::Args 0.26.
SYNOPSIS
This is used internally by Getopt::Complete during compile. A hand-built implementation might use the objects directly, and look like this: # process @ARGV... my $args = Getopt::Complete::Args->new( options => [ # or pass a Getopt::Complete::Options directly 'myfiles=s@' => 'f', 'name' => 'u', 'age=n' => undef, 'fast!' => undef, 'color' => ['red','blue','yellow'], ] argv => \@ARGV ); $args->options->handle_shell_completion; # support 'complete -F _getopt_complete myprogram' if (my @e = $args->errors) { for my $e (@e) { warn $e; } exit 1; } # on to normal running of the program... for my $name ($args->option_names) { my $spec = $args->option_spec($name); my $value = $args->value($name); print "option $name has specification $spec and value $value\n"; }
DESCRIPTION
An object of this class describes a set of option/value pairs, built from a Getopt::Complete::Options object and a list of command-line arguments (@ARGV). This is the class of the $Getopt::Complete::ARGS object, and $ARGS alias created at compile time. It is also the source of the %ARGS hash injected into both of those namepaces at compile time.
METHODS
argv Returns the list of original command-line arguments. options Returns the Getopt::Complete::Options object which was used to parse the command-line. value($option_name) Returns the value for a given option name after parsing. bare_args Returns the bare arguments. The same as ->value('<>') parent_sub_commands When using a tree of sub-commands, gives the list of sub-commands selected, in order to get to this point. The options and option/value pairs apply to just this particular sub-command. The same as ->value('>'). Distinct from ->sub_commands(), which returns the list of next possible choices when drilling down. option_spec($name) Returns the GetOptions specification for the parameter in question. completion_handler($name) Returns the arrayref or code ref which handles resolving valid completions. sub_commands The list of sub-commands which are options at this level of a command tree. This is distinct from sub_command_path, which are the sub-commands which were chosen to get to this level in the tree.
SEE ALSO
Getopt::Complete, Getopt::Complete::Options, Getopt::Complete::Compgen
COPYRIGHT
Copyright 2010 Scott Smith and Washington University School of Medicine
AUTHORS
Scott Smith (sakoht at cpan .org)
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module.