Optimize reversing an array in-place
[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
ed344b9f 14warn( "The 'newgetopt.pl' legacy library is deprecated and will be"
15 . " removed in the next major release of perl. Please use the"
16 . " Getopt::Long module instead." );
17
ee0007ab 18{ package newgetopt;
ee0007ab 19
01e8c204 20 # Values for $order. See GNU getopt.c for details.
21 $REQUIRE_ORDER = 0;
22 $PERMUTE = 1;
23 $RETURN_IN_ORDER = 2;
24
25 # Handle POSIX compliancy.
26 if ( defined $ENV{"POSIXLY_CORRECT"} ) {
27 $autoabbrev = 0; # no automatic abbrev of options (???)
28 $getopt_compat = 0; # disallow '+' to start options
29 $option_start = "(--|-)";
30 $order = $REQUIRE_ORDER;
01d0d956 31 $bundling = 0;
9a24ba61 32 $passthrough = 0;
ee0007ab 33 }
01e8c204 34 else {
35 $autoabbrev = 1; # automatic abbrev of options
36 $getopt_compat = 1; # allow '+' to start options
37 $option_start = "(--|-|\\+)";
38 $order = $PERMUTE;
01d0d956 39 $bundling = 0;
9a24ba61 40 $passthrough = 0;
ee0007ab 41 }
42
01e8c204 43 # Other configurable settings.
44 $debug = 0; # for debugging
45 $ignorecase = 1; # ignore case when matching options
46 $argv_end = "--"; # don't change this!
47}
352d5a3a 48
01e8c204 49use Getopt::Long;
352d5a3a 50
01e8c204 51################ Subroutines ################
352d5a3a 52
01e8c204 53sub NGetOpt {
352d5a3a 54
01e8c204 55 $Getopt::Long::debug = $newgetopt::debug
56 if defined $newgetopt::debug;
57 $Getopt::Long::autoabbrev = $newgetopt::autoabbrev
58 if defined $newgetopt::autoabbrev;
59 $Getopt::Long::getopt_compat = $newgetopt::getopt_compat
60 if defined $newgetopt::getopt_compat;
61 $Getopt::Long::option_start = $newgetopt::option_start
62 if defined $newgetopt::option_start;
63 $Getopt::Long::order = $newgetopt::order
64 if defined $newgetopt::order;
01d0d956 65 $Getopt::Long::bundling = $newgetopt::bundling
66 if defined $newgetopt::bundling;
01e8c204 67 $Getopt::Long::ignorecase = $newgetopt::ignorecase
68 if defined $newgetopt::ignorecase;
9a24ba61 69 $Getopt::Long::ignorecase = $newgetopt::ignorecase
70 if defined $newgetopt::ignorecase;
71 $Getopt::Long::passthrough = $newgetopt::passthrough
72 if defined $newgetopt::passthrough;
01e8c204 73
74 &GetOptions;
75}
352d5a3a 76
01e8c204 77################ Package return ################
352d5a3a 78
352d5a3a 791;
01e8c204 80
81################ End of newgetopt.pl ################