📄 readme
字号:
Module Getopt::Long - extended processing of command line options=================================================================Module Getopt::Long implements an extended getopt function calledGetOptions(). This function implements the POSIX standard for commandline options, with GNU extensions, while still capable of handlingthe traditional one-letter options.In general, this means that command line options can have long namesinstead of single letters, and are introduced with a double dash `--'.Optionally, Getopt::Long can support the traditional bundling ofsingle-letter command line options.Getopt::Long is part of the Perl 5 distribution. It is the successorof newgetopt.pl that came with Perl 4. It is fully upward compatible.In fact, the Perl 5 version of newgetopt.pl is just a wrapper aroundthe module.For complete documentation, see the Getopt::Long POD document or usethe command perldoc Getopt::LongFEATURES========* Long option namesMajor advantage of using long option names is that it is much easierto memorize the option names. Using single-letter names one quicklyruns into the problem that there is no logical relationship betweenthe semantics of the selected option and its option letter.Disadvantage is that it requires more typing. Getopt::Long providesfor option name abbreviation, so option names may be abbreviated touniqueness. Also, modern shells like Cornell's tcsh support optionname completion. As a rule of thumb, you can use abbreviations freelywhile running commands interactively but always use the full names inscripts. Examples (POSIX): --long --width=80 --height=24Extensions: -long (convenience) +width=80 (deprecated) -height 24 (traditional)By default, long option names are case insensitive.* Single-letter options and bundlingWhen single-letter options are requested, Getopt::Long allows theoption names to be bundled, e.g. "-abc" is equivalent to "-a -b -c".In this case, long option names must be introduced with the POSIX "--"introducer.Examples: -lgAd (bundle) -xw 80 (bundle, w takes a value) -xw80 (same) even -l24w80 (l = 24 and w = 80)By default, single-letter option names are case sensitive.* Flexibility: - options can have alternative names, using an alternative name will behave as if the primary name was used; - options can be negatable, e.g. "debug" will switch it on, while "nodebug" will switch it off. - options can set values, but also add values producing an array of values instead of a single scalar value, or set values in a hash. - options can have multiple values, e.g., "--position 25 624".* Options linkageUsing Getopt::Long gives the programmer ultimate control over thecommand line options and how they must be handled: - by setting a global variable in the calling program; - by setting a specified variable; - by entering the option name and the value in an associative array (hash) or object (if it is a blessed hash); - by calling a user-specified subroutine with the option name and the value as arguments (for hash options: the name, key and value); - combinations of the above.* Customization:The module can be customized by specifying settings in the 'use'directive, or by calling a special method, Getopt::Long::Configure.For example, the following two cases are functionally equal: use Getopt::Long qw(:config bundling no_ignore_case);and use Getopt::Long; Getopt::Long::Configure qw(bundling no_ignore_case); Some of the possible customizations. Most of them take a "no_" prefixto reverse the effect: - default Restore default settings. - auto_abbrev Allow option names to be abbreviated to uniqueness. - getopt_compat Allow '+' to start options. - gnu_compat Compatibility with GNU getopt_long(). - permute - require_order Whether non-options are allowed to be mixed with options. permute means that -foo arg1 -bar arg2 arg3 is equivalent to -foo -bar arg1 arg2 arg3 (provided -foo does not take an argument value). require_order means that options processing terminates when the first non-option is encountered. -foo arg1 -bar arg2 arg3 is equivalent to -foo -- arg1 -bar arg2 arg3 - bundling Setting this variable to a non-zero value will allow single-character options to be bundled. To distinguish bundles from long option names, long options must be introduced with "--" and single-character options (and bundles) with "-". - ignore_case Ignore case when matching options. - pass_through Do not issue error messages for unknown options, but leave them (pass-through) in @ARGV. - prefix The string that starts options. See also prefix_pattern. - prefix_pattern A Perl pattern that identifies the strings that introduce options. Default is --|-|\+ unless environment variable POSIXLY_CORRECT has been set, in which case it is --|-. - long_prefix_pattern A perl pattern that is used to identify which prefixes should be treated as long style. Any prefixes that don't match this pattern will have short option semantics. Defaults to --. - debug Enable copious debugging output.* Object oriented interface:Using the object oriented interface, multiple parser objects can beinstantiated, each having their own configuration settings: $p1 = new Getopt::Long::Parser (config => ["bundling"]); $p2 = new Getopt::Long::Parser (config => ["posix"]); if ($p1->getoptions(...options descriptions...)) ...AVAILABILITY============The official version for module Getopt::Long comes with the Perl 5distribution. Newer versions will be made available on the Comprehensive Perl ArchiveNetwork (CPAN), see "http://www.perl.com/CPAN/authors/Johan_Vromans".Or use the CPAN search engine: http://search.cpan.org/search?mode=module&query=Getopt::Long http://search.cpan.org/search?module=Getopt::LongCOPYRIGHT AND DISCLAIMER========================Module Getopt::Long is Copyright 2006,1990 by Johan Vromans.This program is free software; you can redistribute it and/ormodify it under the terms of the Perl Artistic License or theGNU General Public License as published by the Free SoftwareFoundation; either version 2 of the License, or (at your option) anylater version.-------------------------------------------------------------------Johan Vromans jvromans@squirrel.nlSquirrel Consultancy Exloo, the Netherlandshttp://www.squirrel.nl http://www.squirrel.nl/people/jvromans------------------ "Arms are made for hugging" --------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -