# man > AppConfig::Getopt

---
type: CommandReference
command: AppConfig::Getopt
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference
- Instantiate: `my $getopt = AppConfig::Getopt->new($state)`
- Parse `@ARGV`: `$getopt->parse()`
- Parse custom args: `$getopt->parse(\@myargs)`
- Pass [`Getopt::Long`](http://localhost/phpMan.php/perldoc/Getopt%3A%3ALong/markdown) config and parse `@ARGV`: `$getopt->parse(qw(auto_abbrev debug))`
- Config + custom args: `$getopt->parse(qw(debug), \@myargs)`
- Via `AppConfig` shortcut: `my $getopt = $appconfig->getopt()`

## Name
[AppConfig::Getopt](http://localhost/phpMan.php/perldoc/AppConfig%3A%3AGetopt/markdown) - Perl5 module for processing command line arguments via delegation to [Getopt::Long](http://localhost/phpMan.php/perldoc/Getopt%3A%3ALong/markdown).

## Synopsis
perl
use AppConfig::Getopt;

my $state  = AppConfig::State->new(\%cfg);
my $getopt = AppConfig::Getopt->new($state);

$getopt->parse(\@args);          # read args
## Methods

- **`new($state)`** — Constructor. Requires an [AppConfig::State](http://localhost/phpMan.php/perldoc/AppConfig%3A%3AState/markdown) object. Returns a new `AppConfig::Getopt` instance.
- **`parse([@config,] [\@args])`** — Parse command-line arguments using [Getopt::Long](http://localhost/phpMan.php/perldoc/Getopt%3A%3ALong/markdown) and update the associated [AppConfig::State](http://localhost/phpMan.php/perldoc/AppConfig%3A%3AState/markdown). Optional leading arguments are [Getopt::Long configuration](http://localhost/phpMan.php/perldoc/Getopt%3A%3ALong%3A%3AConfigure/markdown) strings (e.g., `qw(auto_abbrev debug)`). An optional array reference specifies the argument list; defaults to `@ARGV`.

When using the parent `AppConfig` module, an `AppConfig::Getopt` object can also be obtained via the `getopt()` method.

## See Also
- [AppConfig](http://localhost/phpMan.php/perldoc/AppConfig/markdown)
- [AppConfig::State](http://localhost/phpMan.php/perldoc/AppConfig%3A%3AState/markdown)
- [AppConfig::Args](http://localhost/phpMan.php/perldoc/AppConfig%3A%3AArgs/markdown)
- [Getopt::Long](http://localhost/phpMan.php/perldoc/Getopt%3A%3ALong/markdown)