diff options
author | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1995-05-30 01:56:48 +0000 |
---|---|---|
committer | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1995-05-30 01:56:48 +0000 |
commit | f06db76b9e41859439aeadb79feb6c603ee741ff (patch) | |
tree | 0898eb19feb17c3aa0ff6916fc182a998f1b9949 /lib/Getopt/Long.pm | |
parent | d1b918924020f633640d8b8cc8294856a82ddc04 (diff) | |
download | perl-f06db76b9e41859439aeadb79feb6c603ee741ff.tar.gz |
This is my patch patch.1g for perl5.001.
This patch only includes updates to the lib/ directory and
the removal of the pod/modpods. The main things are the following:
The modpods are now embedded in their corresponding .pm files.
The Grand AutoLoader patch.
Updates to lib/ExtUtils/xsubpp by Paul Marquess
<pmarquess@bfsec.bt.co.uk>.
Minor changes to a very few modules and pods.
To apply, change to your perl directory, run the commands above, then
apply with
patch -p1 -N < thispatch.
After you apply this patch, you should go on to apply patch.1h and
patch.1i before reConfiguring and building.
Patch and enjoy,
Andy Dougherty doughera@lafcol.lafayette.edu
Dept. of Physics
Lafayette College, Easton PA
Here's the file-by-file description:
lib/AnyDBM_File.pm
Embedded pod.
lib/AutoLoader.pm
Grand AutoLoader patch.
Embedded pod.
lib/AutoSplit.pm
Grand AutoLoader patch.
Embedded pod.
Skip pod sections when splitting .pm files.
lib/Benchmark.pm
lib/Carp.pm
lib/Cwd.pm
lib/English.pm
Grand AutoLoader patch.
Embedded pod.
lib/Exporter.pm
Grand AutoLoader patch.
Embedded pod.
Update comments to match behavior.
lib/ExtUtils/MakeMaker.pm
Include installation of .pod and .pm files.
Space out documentation for better printing with pod2man.
lib/ExtUtils/xsubpp
Patches from Paul Marquess <pmarquess@bfsec.bt.co.uk>, 22 May 1995.
Now at version 1.4.
lib/File/Basename.pm
Embedded pod.
lib/File/CheckTree.pm
Embedded pod.
lib/File/Find.pm
Embedded pod.
Included finddepth pod too.
lib/FileHandle.pm
Embedded pod.
lib/Getopt/Long.pm
Embedded pod.
Fixed PERMUTE order bug.
lib/Getopt/Std.pm
Embedded pod.
Caught accessing undefined element off end of @arg array.
lib/I18N/Collate.pm
lib/IPC/Open2.pm
lib/IPC/Open3.pm
lib/Net/Ping.pm
Embedded pod.
lib/Term/Complete.pm
Embedded pod.
Changed name from complete to Complete to match documentation and
exported name.
lib/Text/Abbrev.pm
Embedded pod.
lib/Text/Tabs.pm
Updated.
lib/integer.pm
lib/less.pm
lib/sigtrap.pm
lib/strict.pm
lib/subs.pm
Embedded pod.
Diffstat (limited to 'lib/Getopt/Long.pm')
-rw-r--r-- | lib/Getopt/Long.pm | 140 |
1 files changed, 139 insertions, 1 deletions
diff --git a/lib/Getopt/Long.pm b/lib/Getopt/Long.pm index 48cda7e12a..43e1e58e59 100644 --- a/lib/Getopt/Long.pm +++ b/lib/Getopt/Long.pm @@ -5,6 +5,144 @@ require Exporter; @ISA = qw(Exporter); @EXPORT = qw(GetOptions); +=head1 NAME + +GetOptions - extended getopt processing + +=head1 SYNOPSIS + + use Getopt::Long; + $result = GetOptions (...option-descriptions...); + +=head1 DESCRIPTION + +The Getopt::Long module implements an extended getopt function called +GetOptions(). This function adheres to the new syntax (long option names, +no bundling). It tries to implement the better functionality of +traditional, GNU and POSIX getopt() functions. + +Each description should designate a valid Perl identifier, optionally +followed by an argument specifier. + +Values for argument specifiers are: + + <none> option does not take an argument + ! option does not take an argument and may be negated + =s :s option takes a mandatory (=) or optional (:) string argument + =i :i option takes a mandatory (=) or optional (:) integer argument + =f :f option takes a mandatory (=) or optional (:) real number argument + +If option "name" is set, it will cause the Perl variable $opt_name to +be set to the specified value. The calling program can use this +variable to detect whether the option has been set. Options that do +not take an argument will be set to 1 (one). + +Options that take an optional argument will be defined, but set to '' +if no actual argument has been supplied. + +If an "@" sign is appended to the argument specifier, the option is +treated as an array. Value(s) are not set, but pushed into array +@opt_name. + +Options that do not take a value may have an "!" argument specifier to +indicate that they may be negated. E.g. "foo!" will allow B<-foo> (which +sets $opt_foo to 1) and B<-nofoo> (which will set $opt_foo to 0). + +The option name may actually be a list of option names, separated by +'|'s, e.g. B<"foo|bar|blech=s". In this example, options 'bar' and +'blech' will set $opt_foo instead. + +Option names may be abbreviated to uniqueness, depending on +configuration variable $autoabbrev. + +Dashes in option names are allowed (e.g. pcc-struct-return) and will +be translated to underscores in the corresponding Perl variable (e.g. +$opt_pcc_struct_return). Note that a lone dash "-" is considered an +option, corresponding Perl identifier is $opt_ . + +A double dash "--" signals end of the options list. + +If the first option of the list consists of non-alphanumeric +characters only, it is interpreted as a generic option starter. +Everything starting with one of the characters from the starter will +be considered an option. + +The default values for the option starters are "-" (traditional), "--" +(POSIX) and "+" (GNU, being phased out). + +Options that start with "--" may have an argument appended, separated +with an "=", e.g. "--foo=bar". + +If configuration variable $getopt_compat is set to a non-zero value, +options that start with "+" may also include their arguments, +e.g. "+foo=bar". + +A return status of 0 (false) indicates that the function detected +one or more errors. + +=head1 EXAMPLES + +If option "one:i" (i.e. takes an optional integer argument), then +the following situations are handled: + + -one -two -> $opt_one = '', -two is next option + -one -2 -> $opt_one = -2 + +Also, assume "foo=s" and "bar:s" : + + -bar -xxx -> $opt_bar = '', '-xxx' is next option + -foo -bar -> $opt_foo = '-bar' + -foo -- -> $opt_foo = '--' + +In GNU or POSIX format, option names and values can be combined: + + +foo=blech -> $opt_foo = 'blech' + --bar= -> $opt_bar = '' + --bar=-- -> $opt_bar = '--' + +=over 12 + +=item $autoabbrev + +Allow option names to be abbreviated to uniqueness. +Default is 1 unless environment variable +POSIXLY_CORRECT has been set. + +=item $getopt_compat + +Allow '+' to start options. +Default is 1 unless environment variable +POSIXLY_CORRECT has been set. + +=item $option_start + +Regexp with option starters. +Default is (--|-) if environment variable +POSIXLY_CORRECT has been set, (--|-|\+) otherwise. + +=item $order + +Whether non-options are allowed to be mixed with +options. +Default is $REQUIRE_ORDER if environment variable +POSIXLY_CORRECT has been set, $PERMUTE otherwise. + +=item $ignorecase + +Ignore case when matching options. Default is 1. + +=item $debug + +Enable debugging output. Default is 0. + +=back + +=head1 NOTE + +Does not yet use the Exporter--or even packages!! +Thus, it's not a real module. + +=cut # newgetopt.pl -- new options parsing @@ -316,7 +454,7 @@ sub GetOptions { # Double dash is option list terminator. if ( $opt eq $argend ) { - unshift (@ret, @ARGV) if $order == $PERMUTE; + unshift (@ARGV, @ret) if $order == $PERMUTE; return ($error == 0); } elsif ( $opt =~ /^$genprefix/ ) { |