{
    "content": [
        {
            "type": "text",
            "text": "# Getopt::Long (perldoc)\n\n**Summary:** Getopt::Long - Extended processing of command line options\n\n**Synopsis:** use Getopt::Long;\nmy $data   = \"file.dat\";\nmy $length = 24;\nmy $verbose;\nGetOptions (\"length=i\" => \\$length,    # numeric\n\"file=s\"   => \\$data,      # string\n\"verbose\"  => \\$verbose)   # flag\nor die(\"Error in command line arguments\\n\");\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (9 lines)\n- **DESCRIPTION** (9 lines)\n- **Command Line Options, an Introduction** (14 lines) — 1 subsections\n  - -lac (19 lines)\n- **Getting Started with Getopt::Long** (18 lines) — 9 subsections\n  - Simple options (46 lines)\n  - Mixing command line option with other arguments (11 lines)\n  - Options with values (20 lines)\n  - Options with multiple values (45 lines)\n  - Options with hash values (17 lines)\n  - User-defined subroutines to handle options (34 lines)\n  - Options with multiple names (11 lines)\n  - Case and abbreviations (8 lines)\n  - Summary of Option Specifications (71 lines)\n- **Advanced Possibilities** (1 lines) — 14 subsections\n  - Object oriented interface (13 lines)\n  - Callback object (13 lines)\n  - Thread Safety (4 lines)\n  - Documentation and help texts (49 lines)\n  - Parsing options from an arbitrary array (19 lines)\n  - Parsing options from an arbitrary string (20 lines)\n  - Storing options values in a hash (41 lines)\n  - Bundling (3 lines)\n  - -vax (13 lines)\n  - -vax (2 lines)\n  - --vax (10 lines)\n  - -h24w80 (21 lines)\n  - The lonesome dash (11 lines)\n  - Argument callback (19 lines)\n- **Configuring Getopt::Long** (179 lines)\n- **Exportable Methods** (48 lines)\n- **Return values and Errors** (8 lines)\n- **Legacy** (6 lines) — 4 subsections\n  - Default destinations (3 lines)\n  - our (15 lines)\n  - Alternative option starters (16 lines)\n  - Configuration variables (4 lines)\n- **Tips and Techniques** (1 lines) — 1 subsections\n  - Pushing multiple values in a hash option (14 lines)\n- **Troubleshooting** (1 lines) — 2 subsections\n  - GetOptions does not return a false result when an option is  (2 lines)\n  - GetOptions does not split the command line correctly (41 lines)\n- **AUTHOR** (2 lines)\n- **COPYRIGHT AND DISCLAIMER** (12 lines)\n\n## Full Content\n\n### NAME\n\nGetopt::Long - Extended processing of command line options\n\n### SYNOPSIS\n\nuse Getopt::Long;\nmy $data   = \"file.dat\";\nmy $length = 24;\nmy $verbose;\nGetOptions (\"length=i\" => \\$length,    # numeric\n\"file=s\"   => \\$data,      # string\n\"verbose\"  => \\$verbose)   # flag\nor die(\"Error in command line arguments\\n\");\n\n### DESCRIPTION\n\nThe Getopt::Long module implements an extended getopt function called GetOptions(). It parses\nthe command line from @ARGV, recognizing and removing specified options and their possible\nvalues.\n\nThis function adheres to the POSIX syntax for command line options, with GNU extensions. In\ngeneral, this means that options have long names instead of single letters, and are introduced\nwith a double dash \"--\". Support for bundling of command line options, as was the case with the\nmore traditional single-letter approach, is provided but not enabled by default.\n\n### Command Line Options, an Introduction\n\nCommand line operated programs traditionally take their arguments from the command line, for\nexample filenames or other information that the program needs to know. Besides arguments, these\nprograms often take command line *options* as well. Options are not necessary for the program to\nwork, hence the name 'option', but are used to modify its default behaviour. For example, a\nprogram could do its job quietly, but with a suitable option it could provide verbose\ninformation about what it did.\n\nCommand line options come in several flavours. Historically, they are preceded by a single dash\n\"-\", and consist of a single letter.\n\n-l -a -c\n\nUsually, these single-character options can be bundled:\n\n#### -lac\n\nOptions can have values, the value is placed after the option character. Sometimes with\nwhitespace in between, sometimes not:\n\n-s 24 -s24\n\nDue to the very cryptic nature of these options, another style was developed that used long\nnames. So instead of a cryptic \"-l\" one could use the more descriptive \"--long\". To distinguish\nbetween a bundle of single-character options and a long one, two dashes are used to precede the\noption name. Early implementations of long options used a plus \"+\" instead. Also, option values\ncould be specified either like\n\n--size=24\n\nor\n\n--size 24\n\nThe \"+\" form is now obsolete and strongly deprecated.\n\n### Getting Started with Getopt::Long\n\nGetopt::Long is the Perl5 successor of \"newgetopt.pl\". This was the first Perl module that\nprovided support for handling the new style of command line options, in particular long option\nnames, hence the Perl5 name Getopt::Long. This module also supports single-character options and\nbundling.\n\nTo use Getopt::Long from a Perl program, you must include the following line in your Perl\nprogram:\n\nuse Getopt::Long;\n\nThis will load the core of the Getopt::Long module and prepare your program for using it. Most\nof the actual Getopt::Long code is not loaded until you really call one of its functions.\n\nIn the default configuration, options names may be abbreviated to uniqueness, case does not\nmatter, and a single dash is sufficient, even for long option names. Also, options may be placed\nbetween non-option arguments. See \"Configuring Getopt::Long\" for more details on how to\nconfigure Getopt::Long.\n\n#### Simple options\n\nThe most simple options are the ones that take no values. Their mere presence on the command\nline enables the option. Popular examples are:\n\n--all --verbose --quiet --debug\n\nHandling simple options is straightforward:\n\nmy $verbose = '';   # option variable with default value (false)\nmy $all = '';       # option variable with default value (false)\nGetOptions ('verbose' => \\$verbose, 'all' => \\$all);\n\nThe call to GetOptions() parses the command line arguments that are present in @ARGV and sets\nthe option variable to the value 1 if the option did occur on the command line. Otherwise, the\noption variable is not touched. Setting the option value to true is often called *enabling* the\noption.\n\nThe option name as specified to the GetOptions() function is called the option *specification*.\nLater we'll see that this specification can contain more than just the option name. The\nreference to the variable is called the option *destination*.\n\nGetOptions() will return a true value if the command line could be processed successfully.\nOtherwise, it will write error messages using die() and warn(), and return a false result.\n\nA little bit less simple options\nGetopt::Long supports two useful variants of simple options: *negatable* options and\n*incremental* options.\n\nA negatable option is specified with an exclamation mark \"!\" after the option name:\n\nmy $verbose = '';   # option variable with default value (false)\nGetOptions ('verbose!' => \\$verbose);\n\nNow, using \"--verbose\" on the command line will enable $verbose, as expected. But it is also\nallowed to use \"--noverbose\", which will disable $verbose by setting its value to 0. Using a\nsuitable default value, the program can find out whether $verbose is false by default, or\ndisabled by using \"--noverbose\".\n\nAn incremental option is specified with a plus \"+\" after the option name:\n\nmy $verbose = '';   # option variable with default value (false)\nGetOptions ('verbose+' => \\$verbose);\n\nUsing \"--verbose\" on the command line will increment the value of $verbose. This way the program\ncan keep track of how many times the option occurred on the command line. For example, each\noccurrence of \"--verbose\" could increase the verbosity level of the program.\n\n#### Mixing command line option with other arguments\n\nUsually programs take command line options as well as other arguments, for example, file names.\nIt is good practice to always specify the options first, and the other arguments last.\nGetopt::Long will, however, allow the options and arguments to be mixed and 'filter out' all the\noptions before passing the rest of the arguments to the program. To stop Getopt::Long from\nprocessing further arguments, insert a double dash \"--\" on the command line:\n\n--size 24 -- --all\n\nIn this example, \"--all\" will *not* be treated as an option, but passed to the program unharmed,\nin @ARGV.\n\n#### Options with values\n\nFor options that take values it must be specified whether the option value is required or not,\nand what kind of value the option expects.\n\nThree kinds of values are supported: integer numbers, floating point numbers, and strings.\n\nIf the option value is required, Getopt::Long will take the command line argument that follows\nthe option and assign this to the option variable. If, however, the option value is specified as\noptional, this will only be done if that value does not look like a valid command line option\nitself.\n\nmy $tag = '';       # option variable with default value\nGetOptions ('tag=s' => \\$tag);\n\nIn the option specification, the option name is followed by an equals sign \"=\" and the letter\n\"s\". The equals sign indicates that this option requires a value. The letter \"s\" indicates that\nthis value is an arbitrary string. Other possible value types are \"i\" for integer values, and\n\"f\" for floating point values. Using a colon \":\" instead of the equals sign indicates that the\noption value is optional. In this case, if no suitable value is supplied, string valued options\nget an empty string '' assigned, while numeric options are set to 0.\n\n#### Options with multiple values\n\nOptions sometimes take several values. For example, a program could use multiple directories to\nsearch for library files:\n\n--library lib/stdlib --library lib/extlib\n\nTo accomplish this behaviour, simply specify an array reference as the destination for the\noption:\n\nGetOptions (\"library=s\" => \\@libfiles);\n\nAlternatively, you can specify that the option can have multiple values by adding a \"@\", and\npass a reference to a scalar as the destination:\n\nGetOptions (\"library=s@\" => \\$libfiles);\n\nUsed with the example above, @libfiles c.q. @$libfiles would contain two strings upon\ncompletion: \"lib/stdlib\" and \"lib/extlib\", in that order. It is also possible to specify that\nonly integer or floating point numbers are acceptable values.\n\nOften it is useful to allow comma-separated lists of values as well as multiple occurrences of\nthe options. This is easy using Perl's split() and join() operators:\n\nGetOptions (\"library=s\" => \\@libfiles);\n@libfiles = split(/,/,join(',',@libfiles));\n\nOf course, it is important to choose the right separator string for each purpose.\n\nWarning: What follows is an experimental feature.\n\nOptions can take multiple values at once, for example\n\n--coordinates 52.2 16.4 --rgbcolor 255 255 149\n\nThis can be accomplished by adding a repeat specifier to the option specification. Repeat\nspecifiers are very similar to the \"{...}\" repeat specifiers that can be used with regular\nexpression patterns. For example, the above command line would be handled as follows:\n\nGetOptions('coordinates=f{2}' => \\@coor, 'rgbcolor=i{3}' => \\@color);\n\nThe destination for the option must be an array or array reference.\n\nIt is also possible to specify the minimal and maximal number of arguments an option takes.\n\"foo=s{2,4}\" indicates an option that takes at least two and at most 4 arguments. \"foo=s{1,}\"\nindicates one or more values; \"foo:s{,}\" indicates zero or more option values.\n\n#### Options with hash values\n\nIf the option destination is a reference to a hash, the option will take, as value, strings of\nthe form *key*\"=\"*value*. The value will be stored with the specified key in the hash.\n\nGetOptions (\"define=s\" => \\%defines);\n\nAlternatively you can use:\n\nGetOptions (\"define=s%\" => \\$defines);\n\nWhen used with command line options:\n\n--define os=linux --define vendor=redhat\n\nthe hash %defines (or %$defines) will contain two keys, \"os\" with value \"linux\" and \"vendor\"\nwith value \"redhat\". It is also possible to specify that only integer or floating point numbers\nare acceptable values. The keys are always taken to be strings.\n\n#### User-defined subroutines to handle options\n\nUltimate control over what should be done when (actually: each time) an option is encountered on\nthe command line can be achieved by designating a reference to a subroutine (or an anonymous\nsubroutine) as the option destination. When GetOptions() encounters the option, it will call the\nsubroutine with two or three arguments. The first argument is the name of the option. (Actually,\nit is an object that stringifies to the name of the option.) For a scalar or array destination,\nthe second argument is the value to be stored. For a hash destination, the second argument is\nthe key to the hash, and the third argument the value to be stored. It is up to the subroutine\nto store the value, or do whatever it thinks is appropriate.\n\nA trivial application of this mechanism is to implement options that are related to each other.\nFor example:\n\nmy $verbose = '';   # option variable with default value (false)\nGetOptions ('verbose' => \\$verbose,\n'quiet'   => sub { $verbose = 0 });\n\nHere \"--verbose\" and \"--quiet\" control the same variable $verbose, but with opposite values.\n\nIf the subroutine needs to signal an error, it should call die() with the desired error message\nas its argument. GetOptions() will catch the die(), issue the error message, and record that an\nerror result must be returned upon completion.\n\nIf the text of the error message starts with an exclamation mark \"!\" it is interpreted specially\nby GetOptions(). There is currently one special command implemented: \"die(\"!FINISH\")\" will cause\nGetOptions() to stop processing options, as if it encountered a double dash \"--\".\n\nHere is an example of how to access the option name and value from within a subroutine:\n\nGetOptions ('opt=i' => \\&handler);\nsub handler {\nmy ($optname, $optvalue) = @;\nprint(\"Option name is $optname and value is $optvalue\\n\");\n}\n\n#### Options with multiple names\n\nOften it is user friendly to supply alternate mnemonic names for options. For example \"--height\"\ncould be an alternate name for \"--length\". Alternate names can be included in the option\nspecification, separated by vertical bar \"|\" characters. To implement the above example:\n\nGetOptions ('length|height=f' => \\$length);\n\nThe first name is called the *primary* name, the other names are called *aliases*. When using a\nhash to store options, the key will always be the primary name.\n\nMultiple alternate names are possible.\n\n#### Case and abbreviations\n\nWithout additional configuration, GetOptions() will ignore the case of option names, and allow\nthe options to be abbreviated to uniqueness.\n\nGetOptions ('length|height=f' => \\$length, \"head\" => \\$head);\n\nThis call will allow \"--l\" and \"--L\" for the length option, but requires a least \"--hea\" and\n\"--hei\" for the head and height options.\n\n#### Summary of Option Specifications\n\nEach option specifier consists of two parts: the name specification and the argument\nspecification.\n\nThe name specification contains the name of the option, optionally followed by a list of\nalternative names separated by vertical bar characters.\n\nlength            option name is \"length\"\nlength|size|l     name is \"length\", aliases are \"size\" and \"l\"\n\nThe argument specification is optional. If omitted, the option is considered boolean, a value of\n1 will be assigned when the option is used on the command line.\n\nThe argument specification can be\n\n!   The option does not take an argument and may be negated by prefixing it with \"no\" or \"no-\".\nE.g. \"foo!\" will allow \"--foo\" (a value of 1 will be assigned) as well as \"--nofoo\" and\n\"--no-foo\" (a value of 0 will be assigned). If the option has aliases, this applies to the\naliases as well.\n\nUsing negation on a single letter option when bundling is in effect is pointless and will\nresult in a warning.\n\n+   The option does not take an argument and will be incremented by 1 every time it appears on\nthe command line. E.g. \"more+\", when used with \"--more --more --more\", will increment the\nvalue three times, resulting in a value of 3 (provided it was 0 or undefined at first).\n\nThe \"+\" specifier is ignored if the option destination is not a scalar.\n\n= *type* [ *desttype* ] [ *repeat* ]\nThe option requires an argument of the given type. Supported types are:\n\ns   String. An arbitrary sequence of characters. It is valid for the argument to start with\n\"-\" or \"--\".\n\ni   Integer. An optional leading plus or minus sign, followed by a sequence of digits.\n\no   Extended integer, Perl style. This can be either an optional leading plus or minus sign,\nfollowed by a sequence of digits, or an octal string (a zero, optionally followed by\n'0', '1', .. '7'), or a hexadecimal string (\"0x\" followed by '0' .. '9', 'a' .. 'f',\ncase insensitive), or a binary string (\"0b\" followed by a series of '0' and '1').\n\nf   Real number. For example 3.14, -6.23E24 and so on.\n\nThe *desttype* can be \"@\" or \"%\" to specify that the option is list or a hash valued. This\nis only needed when the destination for the option value is not otherwise specified. It\nshould be omitted when not needed.\n\nThe *repeat* specifies the number of values this option takes per occurrence on the command\nline. It has the format \"{\" [ *min* ] [ \",\" [ *max* ] ] \"}\".\n\n*min* denotes the minimal number of arguments. It defaults to 1 for options with \"=\" and to\n0 for options with \":\", see below. Note that *min* overrules the \"=\" / \":\" semantics.\n\n*max* denotes the maximum number of arguments. It must be at least *min*. If *max* is\nomitted, *but the comma is not*, there is no upper bound to the number of argument values\ntaken.\n\n: *type* [ *desttype* ]\nLike \"=\", but designates the argument as optional. If omitted, an empty string will be\nassigned to string values options, and the value zero to numeric options.\n\nNote that if a string argument starts with \"-\" or \"--\", it will be considered an option on\nitself.\n\n: *number* [ *desttype* ]\nLike \":i\", but if the value is omitted, the *number* will be assigned.\n\n: + [ *desttype* ]\nLike \":i\", but if the value is omitted, the current value for the option will be\nincremented.\n\n### Advanced Possibilities\n\n#### Object oriented interface\n\nGetopt::Long can be used in an object oriented way as well:\n\nuse Getopt::Long;\n$p = Getopt::Long::Parser->new;\n$p->configure(...configuration options...);\nif ($p->getoptions(...options descriptions...)) ...\nif ($p->getoptionsfromarray( \\@array, ...options descriptions...)) ...\n\nConfiguration options can be passed to the constructor:\n\n$p = new Getopt::Long::Parser\nconfig => [...configuration options...];\n\n#### Callback object\n\nIn version 2.37 the first argument to the callback function was changed from string to object.\nThis was done to make room for extensions and more detailed control. The object stringifies to\nthe option name so this change should not introduce compatibility problems.\n\nThe callback object has the following methods:\n\nname\nThe name of the option, unabbreviated. For an option with multiple names it return the first\n(canonical) name.\n\ngiven\nThe name of the option as actually used, unabbreveated.\n\n#### Thread Safety\n\nGetopt::Long is thread safe when using ithreads as of Perl 5.8. It is *not* thread safe when\nusing the older (experimental and now obsolete) threads implementation that was added to Perl\n5.005.\n\n#### Documentation and help texts\n\nGetopt::Long encourages the use of Pod::Usage to produce help messages. For example:\n\nuse Getopt::Long;\nuse Pod::Usage;\n\nmy $man = 0;\nmy $help = 0;\n\nGetOptions('help|?' => \\$help, man => \\$man) or pod2usage(2);\npod2usage(1) if $help;\npod2usage(-exitval => 0, -verbose => 2) if $man;\n\nEND\n\n=head1 NAME\n\nsample - Using Getopt::Long and Pod::Usage\n\n=head1 SYNOPSIS\n\nsample [options] [file ...]\n\nOptions:\n-help            brief help message\n-man             full documentation\n\n=head1 OPTIONS\n\n=over 8\n\n=item B<-help>\n\nPrint a brief help message and exits.\n\n=item B<-man>\n\nPrints the manual page and exits.\n\n=back\n\n=head1 DESCRIPTION\n\nB<This program> will read the given input file(s) and do something\nuseful with the contents thereof.\n\n=cut\n\nSee Pod::Usage for details.\n\n#### Parsing options from an arbitrary array\n\nBy default, GetOptions parses the options that are present in the global array @ARGV. A special\nentry \"GetOptionsFromArray\" can be used to parse options from an arbitrary array.\n\nuse Getopt::Long qw(GetOptionsFromArray);\n$ret = GetOptionsFromArray(\\@myopts, ...);\n\nWhen used like this, options and their possible values are removed from @myopts, the global\n@ARGV is not touched at all.\n\nThe following two calls behave identically:\n\n$ret = GetOptions( ... );\n$ret = GetOptionsFromArray(\\@ARGV, ... );\n\nThis also means that a first argument hash reference now becomes the second argument:\n\n$ret = GetOptions(\\%opts, ... );\n$ret = GetOptionsFromArray(\\@ARGV, \\%opts, ... );\n\n#### Parsing options from an arbitrary string\n\nA special entry \"GetOptionsFromString\" can be used to parse options from an arbitrary string.\n\nuse Getopt::Long qw(GetOptionsFromString);\n$ret = GetOptionsFromString($string, ...);\n\nThe contents of the string are split into arguments using a call to\n\"Text::ParseWords::shellwords\". As with \"GetOptionsFromArray\", the global @ARGV is not touched.\n\nIt is possible that, upon completion, not all arguments in the string have been processed.\n\"GetOptionsFromString\" will, when called in list context, return both the return status and an\narray reference to any remaining arguments:\n\n($ret, $args) = GetOptionsFromString($string, ... );\n\nIf any arguments remain, and \"GetOptionsFromString\" was not called in list context, a message\nwill be given and \"GetOptionsFromString\" will return failure.\n\nAs with GetOptionsFromArray, a first argument hash reference now becomes the second argument.\nSee the next section.\n\n#### Storing options values in a hash\n\nSometimes, for example when there are a lot of options, having a separate variable for each of\nthem can be cumbersome. GetOptions() supports, as an alternative mechanism, storing options\nvalues in a hash.\n\nTo obtain this, a reference to a hash must be passed *as the first argument* to GetOptions().\nFor each option that is specified on the command line, the option value will be stored in the\nhash with the option name as key. Options that are not actually used on the command line will\nnot be put in the hash, on other words, \"exists($h{option})\" (or defined()) can be used to test\nif an option was used. The drawback is that warnings will be issued if the program runs under\n\"use strict\" and uses $h{option} without testing with exists() or defined() first.\n\nmy %h = ();\nGetOptions (\\%h, 'length=i');       # will store in $h{length}\n\nFor options that take list or hash values, it is necessary to indicate this by appending an \"@\"\nor \"%\" sign after the type:\n\nGetOptions (\\%h, 'colours=s@');     # will push to @{$h{colours}}\n\nTo make things more complicated, the hash may contain references to the actual destinations, for\nexample:\n\nmy $len = 0;\nmy %h = ('length' => \\$len);\nGetOptions (\\%h, 'length=i');       # will store in $len\n\nThis example is fully equivalent with:\n\nmy $len = 0;\nGetOptions ('length=i' => \\$len);   # will store in $len\n\nAny mixture is possible. For example, the most frequently used options could be stored in\nvariables while all other options get stored in the hash:\n\nmy $verbose = 0;                    # frequently referred\nmy $debug = 0;                      # frequently referred\nmy %h = ('verbose' => \\$verbose, 'debug' => \\$debug);\nGetOptions (\\%h, 'verbose', 'debug', 'filter', 'size=i');\nif ( $verbose ) { ... }\nif ( exists $h{filter} ) { ... option 'filter' was specified ... }\n\n#### Bundling\n\nWith bundling it is possible to set several single-character options at once. For example if\n\"a\", \"v\" and \"x\" are all valid options,\n\n#### -vax\n\nwill set all three.\n\nGetopt::Long supports three styles of bundling. To enable bundling, a call to\nGetopt::Long::Configure is required.\n\nThe simplest style of bundling can be enabled with:\n\nGetopt::Long::Configure (\"bundling\");\n\nConfigured this way, single-character options can be bundled but long options (and any of their\nauto-abbreviated shortened forms) must always start with a double dash \"--\" to avoid ambiguity.\nFor example, when \"vax\", \"a\", \"v\" and \"x\" are all valid options,\n\n#### -vax\n\nwill set \"a\", \"v\" and \"x\", but\n\n#### --vax\n\nwill set \"vax\".\n\nThe second style of bundling lifts this restriction. It can be enabled with:\n\nGetopt::Long::Configure (\"bundlingoverride\");\n\nNow, \"-vax\" will set the option \"vax\".\n\nIn all of the above cases, option values may be inserted in the bundle. For example:\n\n#### -h24w80\n\nis equivalent to\n\n-h 24 -w 80\n\nA third style of bundling allows only values to be bundled with options. It can be enabled with:\n\nGetopt::Long::Configure (\"bundlingvalues\");\n\nNow, \"-h24\" will set the option \"h\" to 24, but option bundles like \"-vxa\" and \"-h24w80\" are\nflagged as errors.\n\nEnabling \"bundlingvalues\" will disable the other two styles of bundling.\n\nWhen configured for bundling, single-character options are matched case sensitive while long\noptions are matched case insensitive. To have the single-character options matched case\ninsensitive as well, use:\n\nGetopt::Long::Configure (\"bundling\", \"ignorecasealways\");\n\nIt goes without saying that bundling can be quite confusing.\n\n#### The lonesome dash\n\nNormally, a lone dash \"-\" on the command line will not be considered an option. Option\nprocessing will terminate (unless \"permute\" is configured) and the dash will be left in @ARGV.\n\nIt is possible to get special treatment for a lone dash. This can be achieved by adding an\noption specification with an empty name, for example:\n\nGetOptions ('' => \\$stdio);\n\nA lone dash on the command line will now be a legal option, and using it will set variable\n$stdio.\n\n#### Argument callback\n\nA special option 'name' \"<>\" can be used to designate a subroutine to handle non-option\narguments. When GetOptions() encounters an argument that does not look like an option, it will\nimmediately call this subroutine and passes it one parameter: the argument name.\n\nFor example:\n\nmy $width = 80;\nsub process { ... }\nGetOptions ('width=i' => \\$width, '<>' => \\&process);\n\nWhen applied to the following command line:\n\narg1 --width=72 arg2 --width=60 arg3\n\nThis will call \"process(\"arg1\")\" while $width is 80, \"process(\"arg2\")\" while $width is 72, and\n\"process(\"arg3\")\" while $width is 60.\n\nThis feature requires configuration option permute, see section \"Configuring Getopt::Long\".\n\n### Configuring Getopt::Long\n\nGetopt::Long can be configured by calling subroutine Getopt::Long::Configure(). This subroutine\ntakes a list of quoted strings, each specifying a configuration option to be enabled, e.g.\n\"ignorecase\". To disable, prefix with \"no\" or \"no\", e.g. \"noignorecase\". Case does not\nmatter. Multiple calls to Configure() are possible.\n\nAlternatively, as of version 2.24, the configuration options may be passed together with the\n\"use\" statement:\n\nuse Getopt::Long qw(:config noignorecase bundling);\n\nThe following options are available:\n\ndefault     This option causes all configuration options to be reset to their default values.\n\nposixdefault\nThis option causes all configuration options to be reset to their default values as\nif the environment variable POSIXLYCORRECT had been set.\n\nautoabbrev Allow option names to be abbreviated to uniqueness. Default is enabled unless\nenvironment variable POSIXLYCORRECT has been set, in which case \"autoabbrev\" is\ndisabled.\n\ngetoptcompat\nAllow \"+\" to start options. Default is enabled unless environment variable\nPOSIXLYCORRECT has been set, in which case \"getoptcompat\" is disabled.\n\ngnucompat  \"gnucompat\" controls whether \"--opt=\" is allowed, and what it should do. Without\n\"gnucompat\", \"--opt=\" gives an error. With \"gnucompat\", \"--opt=\" will give option\n\"opt\" and empty value. This is the way GNU getoptlong() does it.\n\nNote that \"--opt value\" is still accepted, even though GNU getoptlong() doesn't.\n\ngnugetopt  This is a short way of setting \"gnucompat\" \"bundling\" \"permute\" \"nogetoptcompat\".\nWith \"gnugetopt\", command line handling should be reasonably compatible with GNU\ngetoptlong().\n\nrequireorder\nWhether command line arguments are allowed to be mixed with options. Default is\ndisabled unless environment variable POSIXLYCORRECT has been set, in which case\n\"requireorder\" is enabled.\n\nSee also \"permute\", which is the opposite of \"requireorder\".\n\npermute     Whether command line arguments are allowed to be mixed with options. Default is\nenabled unless environment variable POSIXLYCORRECT has been set, in which case\n\"permute\" is disabled. Note that \"permute\" is the opposite of \"requireorder\".\n\nIf \"permute\" is enabled, this means that\n\n--foo arg1 --bar arg2 arg3\n\nis equivalent to\n\n--foo --bar arg1 arg2 arg3\n\nIf an argument callback routine is specified, @ARGV will always be empty upon\nsuccessful return of GetOptions() since all options have been processed. The only\nexception is when \"--\" is used:\n\n--foo arg1 --bar arg2 -- arg3\n\nThis will call the callback routine for arg1 and arg2, and then terminate\nGetOptions() leaving \"arg3\" in @ARGV.\n\nIf \"requireorder\" is enabled, options processing terminates when the first\nnon-option is encountered.\n\n--foo arg1 --bar arg2 arg3\n\nis equivalent to\n\n--foo -- arg1 --bar arg2 arg3\n\nIf \"passthrough\" is also enabled, options processing will terminate at the first\nunrecognized option, or non-option, whichever comes first.\n\nbundling (default: disabled)\nEnabling this option will allow single-character options to be bundled. To\ndistinguish bundles from long option names, long options (and any of their\nauto-abbreviated shortened forms) *must* be introduced with \"--\" and bundles with\n\"-\".\n\nNote that, if you have options \"a\", \"l\" and \"all\", and autoabbrev enabled, possible\narguments and option settings are:\n\nusing argument               sets option(s)\n------------------------------------------\n-a, --a                      a\n-l, --l                      l\n-al, -la, -ala, -all,...     a, l\n--al, --all                  all\n\nThe surprising part is that \"--a\" sets option \"a\" (due to auto completion), not\n\"all\".\n\nNote: disabling \"bundling\" also disables \"bundlingoverride\".\n\nbundlingoverride (default: disabled)\nIf \"bundlingoverride\" is enabled, bundling is enabled as with \"bundling\" but now\nlong option names override option bundles.\n\nNote: disabling \"bundlingoverride\" also disables \"bundling\".\n\nNote: Using option bundling can easily lead to unexpected results, especially when\nmixing long options and bundles. Caveat emptor.\n\nignorecase (default: enabled)\nIf enabled, case is ignored when matching option names. If, however, bundling is\nenabled as well, single character options will be treated case-sensitive.\n\nWith \"ignorecase\", option specifications for options that only differ in case,\ne.g., \"foo\" and \"Foo\", will be flagged as duplicates.\n\nNote: disabling \"ignorecase\" also disables \"ignorecasealways\".\n\nignorecasealways (default: disabled)\nWhen bundling is in effect, case is ignored on single-character options also.\n\nNote: disabling \"ignorecasealways\" also disables \"ignorecase\".\n\nautoversion (default:disabled)\nAutomatically provide support for the --version option if the application did not\nspecify a handler for this option itself.\n\nGetopt::Long will provide a standard version message that includes the program name,\nits version (if $main::VERSION is defined), and the versions of Getopt::Long and\nPerl. The message will be written to standard output and processing will terminate.\n\n\"autoversion\" will be enabled if the calling program explicitly specified a version\nnumber higher than 2.32 in the \"use\" or \"require\" statement.\n\nautohelp (default:disabled)\nAutomatically provide support for the --help and -? options if the application did\nnot specify a handler for this option itself.\n\nGetopt::Long will provide a help message using module Pod::Usage. The message,\nderived from the SYNOPSIS POD section, will be written to standard output and\nprocessing will terminate.\n\n\"autohelp\" will be enabled if the calling program explicitly specified a version\nnumber higher than 2.32 in the \"use\" or \"require\" statement.\n\npassthrough (default: disabled)\nWith \"passthrough\" anything that is unknown, ambiguous or supplied with an invalid\noption will not be flagged as an error. Instead the unknown option(s) will be passed\nto the catchall \"<>\" if present, otherwise through to @ARGV. This makes it possible\nto write wrapper scripts that process only part of the user supplied command line\narguments, and pass the remaining options to some other program.\n\nIf \"requireorder\" is enabled, options processing will terminate at the first\nunrecognized option, or non-option, whichever comes first and all remaining\narguments are passed to @ARGV instead of the catchall \"<>\" if present. However, if\n\"permute\" is enabled instead, results can become confusing.\n\nNote that the options terminator (default \"--\"), if present, will also be passed\nthrough in @ARGV.\n\nprefix      The string that starts options. If a constant string is not sufficient, see\n\"prefixpattern\".\n\nprefixpattern\nA Perl pattern that identifies the strings that introduce options. Default is\n\"--|-|\\+\" unless environment variable POSIXLYCORRECT has been set, in which case it\nis \"--|-\".\n\nlongprefixpattern\nA Perl pattern that allows the disambiguation of long and short prefixes. Default is\n\"--\".\n\nTypically you only need to set this if you are using nonstandard prefixes and want\nsome or all of them to have the same semantics as '--' does under normal\ncircumstances.\n\nFor example, setting prefixpattern to \"--|-|\\+|\\/\" and longprefixpattern to\n\"--|\\/\" would add Win32 style argument handling.\n\ndebug (default: disabled)\nEnable debugging output.\n\n### Exportable Methods\n\nVersionMessage\nThis subroutine provides a standard version message. Its argument can be:\n\n*   A string containing the text of a message to print *before* printing the standard\nmessage.\n\n*   A numeric value corresponding to the desired exit status.\n\n*   A reference to a hash.\n\nIf more than one argument is given then the entire argument list is assumed to be a hash. If\na hash is supplied (either as a reference or as a list) it should contain one or more\nelements with the following keys:\n\n\"-message\"\n\"-msg\"\nThe text of a message to print immediately prior to printing the program's usage\nmessage.\n\n\"-exitval\"\nThe desired exit status to pass to the exit() function. This should be an integer, or\nelse the string \"NOEXIT\" to indicate that control should simply be returned without\nterminating the invoking process.\n\n\"-output\"\nA reference to a filehandle, or the pathname of a file to which the usage message should\nbe written. The default is \"\\*STDERR\" unless the exit value is less than 2 (in which\ncase the default is \"\\*STDOUT\").\n\nYou cannot tie this routine directly to an option, e.g.:\n\nGetOptions(\"version\" => \\&VersionMessage);\n\nUse this instead:\n\nGetOptions(\"version\" => sub { VersionMessage() });\n\nHelpMessage\nThis subroutine produces a standard help message, derived from the program's POD section\nSYNOPSIS using Pod::Usage. It takes the same arguments as VersionMessage(). In particular,\nyou cannot tie it directly to an option, e.g.:\n\nGetOptions(\"help\" => \\&HelpMessage);\n\nUse this instead:\n\nGetOptions(\"help\" => sub { HelpMessage() });\n\n### Return values and Errors\n\nConfiguration errors and errors in the option definitions are signalled using die() and will\nterminate the calling program unless the call to Getopt::Long::GetOptions() was embedded in\n\"eval { ... }\", or die() was trapped using $SIG{DIE}.\n\nGetOptions returns true to indicate success. It returns false when the function detected one or\nmore errors during option parsing. These errors are signalled using warn() and can be trapped\nwith $SIG{WARN}.\n\n### Legacy\n\nThe earliest development of \"newgetopt.pl\" started in 1990, with Perl version 4. As a result,\nits development, and the development of Getopt::Long, has gone through several stages. Since\nbackward compatibility has always been extremely important, the current version of Getopt::Long\nstill supports a lot of constructs that nowadays are no longer necessary or otherwise unwanted.\nThis section describes briefly some of these 'features'.\n\n#### Default destinations\n\nWhen no destination is specified for an option, GetOptions will store the resultant value in a\nglobal variable named \"opt\"*XXX*, where *XXX* is the primary name of this option. When a\nprogram executes under \"use strict\" (recommended), these variables must be pre-declared with\n\n#### our\n\nour $optlength = 0;\nGetOptions ('length=i');    # will store in $optlength\n\nTo yield a usable Perl variable, characters that are not part of the syntax for variables are\ntranslated to underscores. For example, \"--fpp-struct-return\" will set the variable\n$optfppstructreturn. Note that this variable resides in the namespace of the calling program,\nnot necessarily \"main\". For example:\n\nGetOptions (\"size=i\", \"sizes=i@\");\n\nwith command line \"-size 10 -sizes 24 -sizes 48\" will perform the equivalent of the assignments\n\n$optsize = 10;\n@optsizes = (24, 48);\n\n#### Alternative option starters\n\nA string of alternative option starter characters may be passed as the first argument (or the\nfirst argument after a leading hash reference argument).\n\nmy $len = 0;\nGetOptions ('/', 'length=i' => $len);\n\nNow the command line may look like:\n\n/length 24 -- arg\n\nNote that to terminate options processing still requires a double dash \"--\".\n\nGetOptions() will not interpret a leading \"<>\" as option starters if the next argument is a\nreference. To force \"<\" and \">\" as option starters, use \"><\". Confusing? Well, using a starter\nargument is strongly deprecated anyway.\n\n#### Configuration variables\n\nPrevious versions of Getopt::Long used variables for the purpose of configuring. Although\nmanipulating these variables still work, it is strongly encouraged to use the \"Configure\"\nroutine that was introduced in version 2.17. Besides, it is much easier.\n\n### Tips and Techniques\n\n#### Pushing multiple values in a hash option\n\nSometimes you want to combine the best of hashes and arrays. For example, the command line:\n\n--list add=first --list add=second --list add=third\n\nwhere each successive 'list add' option will push the value of add into array ref\n$list->{'add'}. The result would be like\n\n$list->{add} = [qw(first second third)];\n\nThis can be accomplished with a destination routine:\n\nGetOptions('list=s%' =>\nsub { push(@{$list{$[1]}}, $[2]) });\n\n### Troubleshooting\n\n#### GetOptions does not return a false result when an option is not supplied\n\nThat's why they're called 'options'.\n\n#### GetOptions does not split the command line correctly\n\nThe command line is not split by GetOptions, but by the command line interpreter (CLI). On Unix,\nthis is the shell. On Windows, it is COMMAND.COM or CMD.EXE. Other operating systems have other\nCLIs.\n\nIt is important to know that these CLIs may behave different when the command line contains\nspecial characters, in particular quotes or backslashes. For example, with Unix shells you can\nuse single quotes (\"'\") and double quotes (\"\"\") to group words together. The following\nalternatives are equivalent on Unix:\n\n\"two words\"\n'two words'\ntwo\\ words\n\nIn case of doubt, insert the following statement in front of your Perl program:\n\nprint STDERR (join(\"|\",@ARGV),\"\\n\");\n\nto verify how your CLI passes the arguments to the program.\n\nUndefined subroutine &main::GetOptions called\nAre you running Windows, and did you write\n\nuse GetOpt::Long;\n\n(note the capital 'O')?\n\nHow do I put a \"-?\" option into a Getopt::Long?\nYou can only obtain this using an alias, and Getopt::Long of at least version 2.13.\n\nuse Getopt::Long;\nGetOptions (\"help|?\");    # -help and -? will both set $opthelp\n\nOther characters that can't appear in Perl identifiers are also supported in aliases with\nGetopt::Long of at version 2.39. Note that the characters \"!\", \"|\", \"+\", \"=\", and \":\" can only\nappear as the first (or only) character of an alias.\n\nAs of version 2.32 Getopt::Long provides auto-help, a quick and easy way to add the options\n--help and -? to your program, and handle them.\n\nSee \"autohelp\" in section \"Configuring Getopt::Long\".\n\n### AUTHOR\n\nJohan Vromans <jvromans@squirrel.nl>\n\n### COPYRIGHT AND DISCLAIMER\n\nThis program is Copyright 1990,2015 by Johan Vromans. This program is free software; you can\nredistribute it and/or modify it under the terms of the Perl Artistic License or the GNU General\nPublic License as published by the Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\nwithout even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See\nthe GNU General Public License for more details.\n\nIf you do not have a copy of the GNU General Public License write to the Free Software\nFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n"
        }
    ],
    "structuredContent": {
        "command": "Getopt::Long",
        "section": "",
        "mode": "perldoc",
        "summary": "Getopt::Long - Extended processing of command line options",
        "synopsis": "use Getopt::Long;\nmy $data   = \"file.dat\";\nmy $length = 24;\nmy $verbose;\nGetOptions (\"length=i\" => \\$length,    # numeric\n\"file=s\"   => \\$data,      # string\n\"verbose\"  => \\$verbose)   # flag\nor die(\"Error in command line arguments\\n\");",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "",
                "long": "--vax",
                "arg": null,
                "description": "will set \"vax\". The second style of bundling lifts this restriction. It can be enabled with: Getopt::Long::Configure (\"bundlingoverride\"); Now, \"-vax\" will set the option \"vax\". In all of the above cases, option values may be inserted in the bundle. For example:"
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "Command Line Options, an Introduction",
                "lines": 14,
                "subsections": [
                    {
                        "name": "-lac",
                        "lines": 19
                    }
                ]
            },
            {
                "name": "Getting Started with Getopt::Long",
                "lines": 18,
                "subsections": [
                    {
                        "name": "Simple options",
                        "lines": 46
                    },
                    {
                        "name": "Mixing command line option with other arguments",
                        "lines": 11
                    },
                    {
                        "name": "Options with values",
                        "lines": 20
                    },
                    {
                        "name": "Options with multiple values",
                        "lines": 45
                    },
                    {
                        "name": "Options with hash values",
                        "lines": 17
                    },
                    {
                        "name": "User-defined subroutines to handle options",
                        "lines": 34
                    },
                    {
                        "name": "Options with multiple names",
                        "lines": 11
                    },
                    {
                        "name": "Case and abbreviations",
                        "lines": 8
                    },
                    {
                        "name": "Summary of Option Specifications",
                        "lines": 71
                    }
                ]
            },
            {
                "name": "Advanced Possibilities",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Object oriented interface",
                        "lines": 13
                    },
                    {
                        "name": "Callback object",
                        "lines": 13
                    },
                    {
                        "name": "Thread Safety",
                        "lines": 4
                    },
                    {
                        "name": "Documentation and help texts",
                        "lines": 49
                    },
                    {
                        "name": "Parsing options from an arbitrary array",
                        "lines": 19
                    },
                    {
                        "name": "Parsing options from an arbitrary string",
                        "lines": 20
                    },
                    {
                        "name": "Storing options values in a hash",
                        "lines": 41
                    },
                    {
                        "name": "Bundling",
                        "lines": 3
                    },
                    {
                        "name": "-vax",
                        "lines": 13
                    },
                    {
                        "name": "-vax",
                        "lines": 2
                    },
                    {
                        "name": "--vax",
                        "lines": 10,
                        "long": "--vax"
                    },
                    {
                        "name": "-h24w80",
                        "lines": 21
                    },
                    {
                        "name": "The lonesome dash",
                        "lines": 11
                    },
                    {
                        "name": "Argument callback",
                        "lines": 19
                    }
                ]
            },
            {
                "name": "Configuring Getopt::Long",
                "lines": 179,
                "subsections": []
            },
            {
                "name": "Exportable Methods",
                "lines": 48,
                "subsections": []
            },
            {
                "name": "Return values and Errors",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "Legacy",
                "lines": 6,
                "subsections": [
                    {
                        "name": "Default destinations",
                        "lines": 3
                    },
                    {
                        "name": "our",
                        "lines": 15
                    },
                    {
                        "name": "Alternative option starters",
                        "lines": 16
                    },
                    {
                        "name": "Configuration variables",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "Tips and Techniques",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Pushing multiple values in a hash option",
                        "lines": 14
                    }
                ]
            },
            {
                "name": "Troubleshooting",
                "lines": 1,
                "subsections": [
                    {
                        "name": "GetOptions does not return a false result when an option is not supplied",
                        "lines": 2
                    },
                    {
                        "name": "GetOptions does not split the command line correctly",
                        "lines": 41
                    }
                ]
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND DISCLAIMER",
                "lines": 12,
                "subsections": []
            }
        ]
    }
}