newgetopt.pl

filter: Statementstmt 82.3% 28 / 34 Branchbran 50.0% 10 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 71.4% 40 / 56 CC 10 SCAR 25.0
CC
10
Cov
70%
NGetOpt
13.3
BEGIN
1.0
CRAP 12.2
« Getopt/Long.pm ↑ Summary Getopt/Long/Parser.pm »
1 # Id: newgetopt.pl,v 1.18 2001/09/21 13:34:59 jv
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.
6 #
7 # In particular, this should not be used as an example of modern Perl
8 # programming techniques.
9 #
10 # Suggested alternative: Getopt::Long
11  
12 1 { package newgetopt;
13  
14 # Values for $order. See GNU getopt.c for details.
15 1 $REQUIRE_ORDER = 0;
16 1 $PERMUTE = 1;
17 1 $RETURN_IN_ORDER = 2;
18  
19 # Handle POSIX compliancy.
20 1 ▶ if ( defined $ENV{"POSIXLY_CORRECT"} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ENV{'POSIXLY_CORRECT'}) { } 0 1 1
21 0 $autoabbrev = 0; # no automatic abbrev of options (???)
22 0 $getopt_compat = 0; # disallow '+' to start options
23 0 $option_start = "(--|-)";
24 0 $order = $REQUIRE_ORDER;
25 0 $bundling = 0;
26 0 $passthrough = 0;
27 }
28 else {
29 1 $autoabbrev = 1; # automatic abbrev of options
30 1 $getopt_compat = 1; # allow '+' to start options
31 1 $option_start = "(--|-|\\+)";
32 1 $order = $PERMUTE;
33 1 $bundling = 0;
34 1 $passthrough = 0;
35 }
36  
37 # Other configurable settings.
38 1 $debug = 0; # for debugging
39 1 $ignorecase = 1; # ignore case when matching options
40 1 $argv_end = "--"; # don't change this!
41 }
42  
43 1 ▶use Getopt::Long;
Subroutine BEGIN: called CC=1 SCAR=0.0
44  
45 ################ Subroutines ################
46  
47 1 ▶sub NGetOpt {
Subroutine NGetOpt: called CC=10 SCAR=25.9
48  
49 1 ▶ $Getopt::Long::debug = $newgetopt::debug
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::debug 1 0 1
50 if defined $newgetopt::debug;
51 1 ▶ $Getopt::Long::autoabbrev = $newgetopt::autoabbrev
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::autoabbrev 1 0 1
52 if defined $newgetopt::autoabbrev;
53 1 ▶ $Getopt::Long::getopt_compat = $newgetopt::getopt_compat
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::getopt_compat 1 0 1
54 if defined $newgetopt::getopt_compat;
55 1 ▶ $Getopt::Long::option_start = $newgetopt::option_start
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::option_start 1 0 1
56 if defined $newgetopt::option_start;
57 1 ▶ $Getopt::Long::order = $newgetopt::order
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::order 1 0 1
58 if defined $newgetopt::order;
59 1 ▶ $Getopt::Long::bundling = $newgetopt::bundling
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::bundling 1 0 1
60 if defined $newgetopt::bundling;
61 1 ▶ $Getopt::Long::ignorecase = $newgetopt::ignorecase
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::ignorecase 1 0 1
62 if defined $newgetopt::ignorecase;
63 1 ▶ $Getopt::Long::ignorecase = $newgetopt::ignorecase
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::ignorecase 1 0 1
64 if defined $newgetopt::ignorecase;
65 1 ▶ $Getopt::Long::passthrough = $newgetopt::passthrough
Branch: 1 branch
BranchTrueFalseTotal
if defined $newgetopt::passthrough 1 0 1
66 if defined $newgetopt::passthrough;
67  
68 1 &GetOptions;
69 }
70  
71 ################ Package return ################
72  
73 1 1;
74  
75 ################ End of newgetopt.pl ################
« Getopt/Long.pm ↑ Summary Getopt/Long/Parser.pm »