Fixed typo: "effecting data" -> "affecting data".
[p5sagit/p5-mst-13.2.git] / lib / newgetopt.pl
CommitLineData
a19443d4 1# $Id: newgetopt.pl,v 1.18 2001/09/21 13:34:59 jv Exp $
2d08fc49 2
3# This library is no longer being maintained, and is included for backward
4# compatibility with Perl 4 programs which may require it.
5# It is now just a wrapper around the Getopt::Long module.
ed344b9f 6# This legacy library is deprecated and will be removed in a future
7# release of perl.
2d08fc49 8#
9# In particular, this should not be used as an example of modern Perl
10# programming techniques.
11#
12# Suggested alternative: Getopt::Long
352d5a3a 13
ee0007ab 14{ package newgetopt;
ee0007ab 15
01e8c204 16 # Values for $order. See GNU getopt.c for details.
17 $REQUIRE_ORDER = 0;
18 $PERMUTE = 1;
19 $RETURN_IN_ORDER = 2;
20
21 # Handle POSIX compliancy.
22 if ( defined $ENV{"POSIXLY_CORRECT"} ) {
23 $autoabbrev = 0; # no automatic abbrev of options (???)
24 $getopt_compat = 0; # disallow '+' to start options
25 $option_start = "(--|-)";
26 $order = $REQUIRE_ORDER;
01d0d956 27 $bundling = 0;
9a24ba61 28 $passthrough = 0;
ee0007ab 29 }
01e8c204 30 else {
31 $autoabbrev = 1; # automatic abbrev of options
32 $getopt_compat = 1; # allow '+' to start options
33 $option_start = "(--|-|\\+)";
34 $order = $PERMUTE;
01d0d956 35 $bundling = 0;
9a24ba61 36 $passthrough = 0;
ee0007ab 37 }
38
01e8c204 39 # Other configurable settings.
40 $debug = 0; # for debugging
41 $ignorecase = 1; # ignore case when matching options
42 $argv_end = "--"; # don't change this!
43}
352d5a3a 44
01e8c204 45use Getopt::Long;
352d5a3a 46
01e8c204 47################ Subroutines ################
352d5a3a 48
01e8c204 49sub NGetOpt {
352d5a3a 50
01e8c204 51 $Getopt::Long::debug = $newgetopt::debug
52 if defined $newgetopt::debug;
53 $Getopt::Long::autoabbrev = $newgetopt::autoabbrev
54 if defined $newgetopt::autoabbrev;
55 $Getopt::Long::getopt_compat = $newgetopt::getopt_compat
56 if defined $newgetopt::getopt_compat;
57 $Getopt::Long::option_start = $newgetopt::option_start
58 if defined $newgetopt::option_start;
59 $Getopt::Long::order = $newgetopt::order
60 if defined $newgetopt::order;
01d0d956 61 $Getopt::Long::bundling = $newgetopt::bundling
62 if defined $newgetopt::bundling;
01e8c204 63 $Getopt::Long::ignorecase = $newgetopt::ignorecase
64 if defined $newgetopt::ignorecase;
9a24ba61 65 $Getopt::Long::ignorecase = $newgetopt::ignorecase
66 if defined $newgetopt::ignorecase;
67 $Getopt::Long::passthrough = $newgetopt::passthrough
68 if defined $newgetopt::passthrough;
01e8c204 69
70 &GetOptions;
71}
352d5a3a 72
01e8c204 73################ Package return ################
352d5a3a 74
352d5a3a 751;
01e8c204 76
77################ End of newgetopt.pl ################