NAME

Getopt::Complete::Args - a set of option/value pairs

VERSION

This document describes Getopt::Complete::Args v0.5.

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 -C myprogram 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->option_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.

option_value($name)

Returns the value for a given option name after parsing.

option_spec($name)

Returns the GetOptions specification for the parameter in question.

opion_handler($name)

Returns the arrayref or code ref which handles resolving valid completions.

SEE ALSO

Getopt::Complete, Getopt::Complete::Options, Getopt::Complete::Compgen

COPYRIGHT

Copyright 2009 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.