blib/lib/Getopt/ExPar.pm

filter: Statementstmt 12.8% 204 / 1589 Branchbran 15.2% 59 / 388 Conditioncond 3.2% 3 / 93 MC/DCmcdc 0.0% 0 / 55 Subroutinesub 6.6% 34 / 508 Podpod 0.2% 1 / 423 totaltotal 9.8% 301 / 3056 CC 270 SCAR 76.3
CC
270
Cov
13%
_parse
13572.0
__print_help
870.0
_argh
156.0
CRAP 2066.6
↑ Summary Getopt/t/1.t »
1 package Getopt::ExPar;
2  
3 1 $VERSION = "1.01";
4  
5 # See the bottom of this file for the POD documentation. Search for the string '=head'.
6  
7 1 ▶use English;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use vars qw(@ISA $VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 @ISA = qw();
15 1 ▶use AutoLoader ();
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 *AUTOLOAD = \&AutoLoader::AUTOLOAD;
17  
18 # ExPar.pm - Extended Parameters
19 #
20 # Harlin L. Hamilton Jr. <mailto:harlinh@cadence.com>
21 #
22 # This package is free, and can be modified or redistributed under # the same terms as Perl itself.
23  
24 #### Method: new
25 #######################################################################
26 # Contructor routine.
27 #######################################################################
28 1 ▶sub _new {
Subroutine _new: called CC=3 SCAR=11.3
29 1 my($class, $prefs) = @_;
30  
31 #Initilize $self
32 1 my($self) = {};
33 1 $self->{'prefs'} = {
34 'ooRoutines' => 1,
35 'development_check' => 0,
36 'abbreviations' => 0,
37 'filelistpref' => -1,
38 'ignorecase' => 0,
39 'switchglomming' => 0,
40 'intermingledFiles' => 0,
41 };
42 1 $self->{'parameter'} = {};
43 1 $self->{'aliasnamehash'} = {};
44  
45 #Overwrite elements in $self as specified by $prefs hash
46 1 ▶ &__parse_prefs($self, $prefs) if ((defined $prefs) and (ref($prefs) eq 'HASH'));
Branch: 1 branch
BranchTrueFalseTotal
if defined $prefs and ref $prefs eq "HASH" 1 0 1
Condition33%1/3
defined $prefs and ref $prefs eq "HASH"
!ll&&!rl&&r
001
MC/DC0%0/2
defined $prefs and ref $prefs eq "HASH"
defined $prefs ref $prefs eq "HASH"
Truth table33%1/3
A and B
A= defined $prefsB= ref $prefs eq "HASH"
ABresult
0X0
100
111
47  
48 #Grab predefined types: integer, real, key, etc.
49 1 &__assert_predefined_types($self);
50  
51 #Bless object into class and return
52 1 bless $self, $class;
53 }
54  
55 #Preference methods
56 0 ▶sub _ooRoutines {
Subroutine _ooRoutines: not called CC=2 SCAR=17.9
57 0 my($self) = shift;
58 0 my($value) = shift;
59 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
60 0 $self->{'prefs'}->{'ooRoutines'} = $value;
61 } else {
62 0 return $self->{'prefs'}->{'ooRoutines'};
63 }
64 }
65 0 ▶sub _development_check {
Subroutine _development_check: not called CC=2 SCAR=17.9
66 0 my($self) = shift;
67 0 my($value) = shift;
68 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
69 0 $self->{'prefs'}->{'development_check'} = $value;
70 } else {
71 0 return $self->{'prefs'}->{'development_check'};
72 }
73 }
74 0 ▶sub _abbreviations {
Subroutine _abbreviations: not called CC=2 SCAR=17.9
75 0 my($self) = shift;
76 0 my($value) = shift;
77 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
78 0 $self->{'prefs'}->{'abbreviations'} = $value;
79 } else {
80 0 return $self->{'prefs'}->{'abbreviations'};
81 }
82 }
83 0 ▶sub _filelistpref {
Subroutine _filelistpref: not called CC=2 SCAR=17.9
84 0 my($self) = shift;
85 0 my($value) = shift;
86 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
87 0 $self->{'prefs'}->{'filelistpref'} = $value;
88 } else {
89 0 return $self->{'prefs'}->{'filelistpref'};
90 }
91 }
92 0 ▶sub _ignorecase {
Subroutine _ignorecase: not called CC=2 SCAR=17.9
93 0 my($self) = shift;
94 0 my($value) = shift;
95 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
96 0 $self->{'prefs'}->{'ignorecase'} = $value;
97 } else {
98 0 return $self->{'prefs'}->{'ignorecase'};
99 }
100 }
101 0 ▶sub _switchglomming {
Subroutine _switchglomming: not called CC=2 SCAR=17.9
102 0 my($self) = shift;
103 0 my($value) = shift;
104 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
105 0 $self->{'prefs'}->{'switchglomming'} = $value;
106 } else {
107 0 return $self->{'prefs'}->{'switchglomming'};
108 }
109 }
110 0 ▶sub _intermingledFiles {
Subroutine _intermingledFiles: not called CC=2 SCAR=17.9
111 0 my($self) = shift;
112 0 my($value) = shift;
113 0 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 0 0 0
114 0 $self->{'prefs'}->{'intermingledFiles'} = $value;
115 } else {
116 0 return $self->{'prefs'}->{'intermingledFiles'};
117 }
118 }
119  
120 #### Method: argl
121 ############################################################################
122 #Routine to return the value (or the next value) of the specified parameter
123 ############################################################################
124 0 ▶sub _argl {
Subroutine _argl: not called CC=8 SCAR=42.8
125 0 my($self) = shift;
126 0 my($parameter) = shift;
127 0 ▶ return undef unless (exists $self->{'OPT'}->{$parameter});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"OPT"}{$parameter} 0 0 0
128 0 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 0 0
129 0 ▶ if (ref($self->{'OPT'}->{$parameter}) eq 'SCALAR') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $self->{'OPT'}{$parameter} eq 'SCALAR') { } 0 0 0
elsif (ref $self->{'OPT'}{$parameter} eq 'ARRAY') { } 0 0 0
130 0 return $self->{'OPT'}->{$parameter};
131 } elsif (ref($self->{'OPT'}->{$parameter}) eq 'ARRAY') {
132 $self->{$pKind}->{$parameter}->{'cnt'} = 0
133 0 ▶ unless (exists $self->{$pKind}->{$parameter}->{'cnt'});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{$pKind}{$parameter}{"cnt"} 0 0 0
134 0 ▶ if ($self->{$pKind}->{$parameter}->{'cnt'} > $#{$self->{'OPT'}->{$parameter}}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{$pKind}{$parameter}{'cnt'} > $#{$$self{'OPT'}{$parameter};}) { } 0 0 0
elsif (@{$self->{'OPT'}{$parameter}[$self->{$pKind}{$parameter}{'cnt'}];} > 1) { } 0 0 0
135 0 return undef;
136 0 } elsif (@{$self->{'OPT'}->{$parameter}->[$self->{$pKind}->{$parameter}->{'cnt'}]} > 1) {
137 0 return $self->{'OPT'}->{$parameter}->[$self->{$pKind}->{$parameter}->{'cnt'}++];
138 } else {
139 0 return $self->{'OPT'}->{$parameter}->[$self->{$pKind}->{$parameter}->{'cnt'}++]->[0];
140 }
141 }
142 }
143  
144 #### Method: arglprepare
145 ############################################################################
146 #Routine to prepare for calling _argl
147 ############################################################################
148 0 ▶sub _arglprepare {
Subroutine _arglprepare: not called CC=2 SCAR=17.9
149 0 my($self) = shift;
150 0 my($parameter) = shift;
151 0 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 0 0
152 0 delete $self->{$pKind}->{$parameter}->{'cnt'};
153 }
154  
155 #### Method: arg
156 ############################################################################
157 #Routine to return the *first* value for specified parameter unless the
158 # parameter is a 'switch' then return the scalar value.
159 ############################################################################
160 0 ▶sub _arg {
Subroutine _arg: not called CC=6 SCAR=37.4
161 0 my($self) = shift;
162 0 my($parameter) = shift;
163 0 ▶ return undef unless (exists $self->{'OPT'}->{$parameter});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"OPT"}{$parameter} 0 0 0
164 0 ▶ if (ref($self->{'OPT'}->{$parameter}) ne 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'OPT'}{$parameter} ne 'ARRAY') { } 0 0 0
165 0 return $self->{'OPT'}->{$parameter};
166 } else {
167 0 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 0 0
168 0 my($r) = [];
169 0 ▶ if ($pKind eq 'parameter') {
Branch: 1 branch
BranchTrueFalseTotal
if ($pKind eq 'parameter') { } 0 0 0
170 0 ▶ if (@{$self->{'OPT'}->{$parameter}->[0]} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{'OPT'}{$parameter}[0];} == 1) { } 0 0 0
171 0 return $self->{'OPT'}->{$parameter}->[0]->[0];
172 } else {
173 0 return $self->{'OPT'}->{$parameter}->[0];
174 }
175 } else {
176 0 return $self->{'OPT'}->{$parameter}->[0];
177 }
178 0 return undef;
179 }
180 }
181  
182 #### Method: argv/args
183 ############################################################################
184 #Routine to return all values as an ARRAY ref for specified parameter.
185 # Or array of array refs if multiple arguments for specified parameter.
186 ############################################################################
187 0 ▶sub _argv { return &_args(@_); }
Subroutine _argv: not called CC=1 SCAR=6.9
188 0 ▶sub _args {
Subroutine _args: not called CC=9 SCAR=45.0
189 0 my($self) = shift;
190 0 my($parameter) = shift;
191 0 ▶ return [] unless (exists $self->{'OPT'}->{$parameter});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"OPT"}{$parameter} 0 0 0
192 0 ▶ if (ref($self->{'OPT'}->{$parameter}) ne 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'OPT'}{$parameter} ne 'ARRAY') { } 0 0 0
193 0 return [ $self->{'OPT'}->{$parameter} ];
194 } else {
195 0 my($r) = [];
196 0 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 0 0
197 0 ▶ if ($pKind eq 'parameter') {
Branch: 1 branch
BranchTrueFalseTotal
if ($pKind eq 'parameter') { } 0 0 0
198 0 foreach my $a ( @{$self->{'OPT'}->{$parameter}} ) {
199 0 ▶ if ($#{$a} > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#{$a;} > 0) { } 0 0 0
200 0 my(@a) = @{$a};
201 0 push(@{$r}, \@a); #array of arrays
202 } else {
203 0 push(@{$r}, $a->[0]); #array of scalars
204 }
205 }
206 } else {
207 0 foreach my $s ( @{$self->{'OPT'}->{$parameter}} ) {
208 0 ▶ if ($#{$s} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#{$s;} > 1) { } 0 0 0
209 0 push(@{$r}, @{$s}[1..$#{$s}]); #array of arrays
210 } else {
211 0 push(@{$r}, $s->[1]); #array of scalars
212 }
213 }
214 }
215 0 return $r;
216 }
217 }
218  
219 #### Method: argh
220 ############################################################################
221 #Routine to return all values as a HASH ref for specified parameter.
222 # Hash keys are numeric preserving order of parameters.
223 #If multi_parameter, returns all args as hash of hashes where subhashes are
224 # name/value pairs.
225 ############################################################################
226 0 ▶sub _argh {
Subroutine _argh: not called CC=12 SCAR=50.5
227 0 my($self) = shift;
228 0 my($parameter) = shift;
229 0 ▶ return {} unless (exists $self->{'OPT'}->{$parameter});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"OPT"}{$parameter} 0 0 0
230 0 ▶ if (ref($self->{'OPT'}->{$parameter}) eq 'SCALAR') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $self->{'OPT'}{$parameter} eq 'SCALAR') { } 0 0 0
elsif (ref $self->{'OPT'}{$parameter} eq 'ARRAY') { } 0 0 0
231 0 return { $self->{'OPT'}->{$parameter} => 1 };
232 } elsif (ref($self->{'OPT'}->{$parameter}) eq 'ARRAY') {
233 0 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 0 0
234 #If multi_parameter
235 0 ▶ if (exists $self->{'parameter'}->{$parameter}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'parameter'}{$parameter}) { } 0 0 0
236 0 ▶ if (exists $self->{'parameter'}->{$parameter}->{'name'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'parameter'}{$parameter}{'name'}) { } 0 0 0
237 0 my($r) = {};
238 0 foreach my $i ( 0 .. $#{$self->{'OPT'}->{$parameter}} ) {
239 $r->{$i} = { map { $self->{'parameter'}->{$parameter}->{'name'}->[$_],
240 0 $self->{'OPT'}->{$parameter}->[$i]->[$_] }
241 0 0 .. $#{$self->{'parameter'}->{$parameter}->{'name'}} };
242 }
243 0 return $r;
244 } else {
245 0 my($i) = 0;
246 0 return { map { $i++, $_->[0] } @{$self->{'OPT'}->{$parameter}} };
247 }
248 } else { # special parameter
249 0 ▶ if (@{$self->{'OPT'}->{$parameter}->[0]} == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (@{$self->{'OPT'}{$parameter}[0];} == 1) { } 0 0 0
elsif (@{$self->{'OPT'}{$parameter}[0];} == 2) { } 0 0 0
250 0 return { 0 => { $parameter => $self->{'OPT'}->{$parameter}->[0]->[0], }, };
251 0 } elsif (@{$self->{'OPT'}->{$parameter}->[0]} == 2) {
252 0 return { 0 => { $parameter => $self->{'OPT'}->{$parameter}->[0]->[0], 'opt' => $self->{'OPT'}->{$parameter}->[0]->[1], }, };
253 } else {
254 0 my($r) = {};
255 0 foreach my $i ( 0 .. $#{$self->{'OPT'}->{$parameter}} ) {
256 $r->{$i} = { map { ($_ == 0)? $parameter : $self->{'special'}->{$parameter}->{'name'}->[$_-1],
257 0 ▶ $self->{'OPT'}->{$parameter}->[$i]->[$_] }
Branch: 1 branch
BranchTrueFalseTotal
$_ == 0 ? : 0 0 0
258 0 0 .. $#{$self->{'OPT'}->{$parameter}->[0]} };
259 }
260 0 return $r;
261 }
262 }
263 } else {
264 0 return undef;
265 }
266 }
267  
268 #### Method: argc
269 ############################################################################
270 #Routine to return number of arguments for specified parameter
271 ############################################################################
272 0 ▶sub _argc {
Subroutine _argc: not called CC=3 SCAR=24.8
273 0 my($self) = shift;
274 0 my($parameter) = shift;
275 0 ▶ if (exists $self->{'OPT'}->{$parameter}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'OPT'}{$parameter}) { } 0 0 0
276 0 ▶ if (ref($self->{'OPT'}->{$parameter}) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'OPT'}{$parameter} eq 'ARRAY') { } 0 0 0
277 0 return $#{$self->{'OPT'}->{$parameter}}+1;
278 } else {
279 0 return $self->{'OPT'}->{$parameter};
280 }
281 } else {
282 0 return 0;
283 }
284 }
285  
286 #### Method: arge/argt
287 ############################################################################
288 #Routine to return 0/1 depending on existance of specified parameter.
289 # Or for special parameters, can check existance of a specific arg.
290 ############################################################################
291 0 ▶sub _arge { return &_argt(@_); }
Subroutine _arge: not called CC=1 SCAR=6.9
292 0 ▶sub _argt {
Subroutine _argt: not called CC=8 SCAR=42.8
293 0 my($self) = shift;
294 0 my($parameter) = shift;
295 0 ▶ return 0 unless (exists $self->{'OPT'}->{$parameter});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"OPT"}{$parameter} 0 0 0
296 0 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 0 0
297 0 ▶ if ($pKind eq 'parameter') {
Branch: 1 branch
BranchTrueFalseTotal
if ($pKind eq 'parameter') { } 0 0 0
298 0 ▶ return (exists $self->{'stats'}->{$parameter})? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'stats'}{$parameter} ? : 0 0 0
299 } else {
300 0 my($arg) = shift;
301 0 ▶ return (exists $self->{'OPT'}->{$parameter}) unless (defined $arg);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $arg 0 0 0
302 0 foreach my $a ( @{$self->{'OPT'}->{$parameter}} ) {
303 0 ▶ return 1 if ($a->[0] =~ /$arg/);
Branch: 1 branch
BranchTrueFalseTotal
if $a->[0] =~ /$arg/ 0 0 0
304 }
305 }
306 0 return 0;
307 }
308  
309 #### Method: filelist/files
310 ############################################################################
311 #Routine to return filelist if one exists
312 ############################################################################
313 0 ▶sub _files { return &_filelist(@_); }
Subroutine _files: not called CC=1 SCAR=6.9
314 0 ▶sub _filelist {
Subroutine _filelist: not called CC=2 SCAR=17.9
315 0 my($self) = shift;
316 0 ▶ return undef unless (exists $self->{'OPT'}->{'filelist'});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"OPT"}{"filelist"} 0 0 0
317 0 return ($self->{'OPT'}->{'filelist'});
318 }
319  
320 #### Method: parse
321 #######################################################################
322 #Routine to parse the command line options
323 #######################################################################
324 0 ▶sub _parse {
Subroutine _parse: not called CC=116 SCAR=95.2
325 0 my($self) = shift;
326 0 my($argv) = shift;
327  
328 #Init some hashes
329 0 $self->{'OPT'} = {};
330 0 $self->{'stats'} = {};
331 0 $self->{'actions'}->{'help'} = 0;
332  
333 #Parse @ARGV unless an array reference is passed in as second argument
334 0 ▶ $argv = \@ARGV unless ((defined $argv) and (ref($argv) eq 'ARRAY'));
Branch: 1 branch
BranchTrueFalseTotal
unless defined $argv and ref $argv eq "ARRAY" 0 0 0
Condition0%0/3
defined $argv and ref $argv eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $argv and ref $argv eq "ARRAY"
defined $argv ref $argv eq "ARRAY"
Truth table0%0/3
A and B
A= defined $argvB= ref $argv eq "ARRAY"
ABresult
0X0
100
111
335  
336 #Do some development checking here
337 0 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 0 0 0
338 #Check to make sure that a help_option value exists for all special parameters
339 0 my($str) = [];
340 0 foreach my $par ( keys %{$self->{'parameter'}} ) {
341 0 ▶ push(@{$str}, $par) unless (exists $self->{'parameter'}->{$par}->{'help'});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"parameter"}{$par}{"help"} 0 0 0
342 }
343 0 foreach my $spec ( keys %{$self->{'special'}} ) {
344 0 ▶ push(@{$str}, $spec) unless (exists $self->{'special'}->{$spec}->{'help'});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"special"}{$spec}{"help"} 0 0 0
345 }
346 0 ▶ carp "Missing help text for these options: ", join(', ', sort @{$str}) if (@{$str} > 0);
Branch: 1 branch
BranchTrueFalseTotal
if @{$str;} > 0 0 0 0
347 0 $str = [];
348 0 foreach my $spec ( keys %{$self->{'special'}} ) {
349 0 ▶ push(@{$str}, $spec) unless (exists $self->{'special'}->{$spec}->{'help_option'});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"special"}{$spec}{"help_option"} 0 0 0
350 }
351 0 ▶ carp "Missing help_option string for these special parameters: ", join(', ', sort @{$str}) if (@{$str} > 0);
Branch: 1 branch
BranchTrueFalseTotal
if @{$str;} > 0 0 0 0
352 }
353  
354 #Very first thing is to check for '-help' options.
355 0 ▶ if (@{$argv} and ($argv->[0] eq '--help')) {
Branch: 3 branches
BranchTrueFalseTotal
if (@{$argv;} and $argv->[0] eq '--help') { } 0 0 0
elsif (@{$argv;} and $argv->[0] eq '--full_help') { } 0 0 0
elsif ($self->{'prefs'}{'switchglomming'} and @{$argv;} and $argv->[0] =~ /^-([a-zA-Z0-9]+)$/ and $self->{'prefs'}{'ignorecase'} && !exists($self->{'parameter'}{lc $1}) || !exists $self->{'parameter'}{$1} and $self->{'prefs'}{'ignorecase'} && !exists($self->{'aliasnamehash'}{lc $1}) || !exists $self->{'aliasnamehash'}{$1}) { } 0 0 0
Condition0%0/3
@{$argv;} and $argv->[0] eq "--help"
!ll&&!rl&&r
000
MC/DC0%0/2
@{$argv;} and $argv->[0] eq "--help"
@{$argv;} $argv->[0] eq "--help"
Truth table0%0/3
A and B
A= @{$argv;}B= $argv->[0] eq "--help"
ABresult
0X0
100
111
356 0 $self->{'actions'}->{'help'} = 1;
357 0 shift(@{$argv});
358 0 ▶ } elsif (@{$argv} and ($argv->[0] eq '--full_help')) {
Condition0%0/3
@{$argv;} and $argv->[0] eq "--full_help"
!ll&&!rl&&r
000
MC/DC0%0/2
@{$argv;} and $argv->[0] eq "--full_help"
@{$argv;} $argv->[0] eq "--full_help"
Truth table0%0/3
A and B
A= @{$argv;}B= $argv->[0] eq "--full_help"
ABresult
0X0
100
111
359 0 $self->{'actions'}->{'help'} = 2;
360 0 shift(@{$argv});
361  
362 #Check for first element of $argv for 'switchglomming'. To meet this criteria,
363 # the option must not match a defined parameter or alias, and it must not
364 # match an abbreviated option if 'abbreviations' is enabled.
365 #This 'if' statement also checks to make sure that the next command line argument
366 # starts with a '-', OR that trailing file names are permitted.
367 ▶ } elsif (($self->{'prefs'}->{'switchglomming'}) and
Condition0%0/12
$self->{"prefs"}{"switchglomming"} and @{$argv;} and $argv->[0] =~ /^-([a-zA-Z0-9]+)$/ and $self->{"prefs"}{"ignorecase"} && !exists($self->{"parameter"}{lc $1}) || !exists $self->{"parameter"}{$1} and $self->{"prefs"}{"ignorecase"} && !exists($self->{"aliasnamehash"}{lc $1}) || !exists $self->{"aliasnamehash"}{$1}
!ll&&!rl&&r
000
$self->{"prefs"}{"switchglomming"} and @{$argv;} and $argv->[0] =~ /^-([a-zA-Z0-9]+)$/ and $self->{"prefs"}{"ignorecase"} && !exists($self->{"parameter"}{lc $1}) || !exists $self->{"parameter"}{$1}
!ll&&!rl&&r
000
$self->{"prefs"}{"switchglomming"} and @{$argv;} and $argv->[0] =~ /^-([a-zA-Z0-9]+)$/
!ll&&!rl&&r
000
$self->{"prefs"}{"switchglomming"} and @{$argv;}
!ll&&!rl&&r
000
MC/DC0%0/5
$self->{"prefs"}{"switchglomming"} and @{$argv;} and $argv->[0] =~ /^-([a-zA-Z0-9]+)$/ and $self->{"prefs"}{"ignorecase"} && !exists($self->{"parameter"}{lc $1}) || !exists $self->{"parameter"}{$1} and $self->{"prefs"}{"ignorecase"} && !exists($self->{"aliasnamehash"}{lc $1}) || !exists $self->{"aliasnamehash"}{$1}
$self->{"prefs"}{"switchglomming"} @{$argv;} $argv->[0] =~ /^-([a-zA-Z0-9]+)$/ $self->{"prefs"}{"ignorecase"} && !exists($self->{"parameter"}{lc $1}) || !exists $self->{"parameter"}{$1} $self->{"prefs"}{"ignorecase"} && !exists($self->{"aliasnamehash"}{lc $1}) || !exists $self->{"aliasnamehash"}{$1}
Truth table0%0/6
A and B and C and D and E
A= $self->{"prefs"}{"switchglomming"}B= @{$argv;}C= $argv->[0] =~ /^-([a-zA-Z0-9]+)$/D= $self->{"prefs"}{"ignorecase"} && !exists($self->{"parameter"}{lc $1}) || !exists $self->{"parameter"}{$1}E= $self->{"prefs"}{"ignorecase"} && !exists($self->{"aliasnamehash"}{lc $1}) || !exists $self->{"aliasnamehash"}{$1}
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
368 0 ▶ @{$argv} and ($argv->[0] =~ /^-([a-zA-Z0-9]+)$/) and
Condition0%0/12
$self->{"prefs"}{"ignorecase"} and not exists $self->{"parameter"}{lc $1} or not exists $self->{"parameter"}{$1}
l!l&&r!l&&!r
000
$self->{"prefs"}{"ignorecase"} and not exists $self->{"parameter"}{lc $1}
!ll&&!rl&&r
000
$self->{"prefs"}{"ignorecase"} and not exists $self->{"aliasnamehash"}{lc $1} or not exists $self->{"aliasnamehash"}{$1}
l!l&&r!l&&!r
000
$self->{"prefs"}{"ignorecase"} and not exists $self->{"aliasnamehash"}{lc $1}
!ll&&!rl&&r
000
MC/DC0%0/3
$self->{"prefs"}{"ignorecase"} and not exists $self->{"parameter"}{lc $1} or not exists $self->{"parameter"}{$1}
$self->{"prefs"}{"ignorecase"} not exists $self->{"parameter"}{lc $1} not exists $self->{"parameter"}{$1}
MC/DC0%0/3
$self->{"prefs"}{"ignorecase"} and not exists $self->{"aliasnamehash"}{lc $1} or not exists $self->{"aliasnamehash"}{$1}
$self->{"prefs"}{"ignorecase"} not exists $self->{"aliasnamehash"}{lc $1} not exists $self->{"aliasnamehash"}{$1}
Truth table0%0/5
A and not(B) or not(C)
A= $self->{"prefs"}{"ignorecase"}B= not exists $self->{"parameter"}{lc $1}C= not exists $self->{"parameter"}{$1}
ABCresult
11X1
0X11
1011
0X00
1000
Truth table0%0/5
A and not(B) or not(C)
A= $self->{"prefs"}{"ignorecase"}B= not exists $self->{"aliasnamehash"}{lc $1}C= not exists $self->{"aliasnamehash"}{$1}
ABCresult
11X1
0X11
1011
0X00
1000
369 (($self->{'prefs'}->{'ignorecase'} and (not exists $self->{'parameter'}->{lc($1)})) or
370 (not exists $self->{'parameter'}->{$1})) and
371 (($self->{'prefs'}->{'ignorecase'} and (not exists $self->{'aliasnamehash'}->{lc($1)})) or
372 (not exists $self->{'aliasnamehash'}->{$1}))) {
373 #Now that we've checked to see if it's a defined parameter or an alias, we need to
374 # check to see if it's a match on a parameter abbreviation.
375 0 my(@abb);
376 0 ▶ if ($self->{'prefs'}->{'ignorecase'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'prefs'}{'ignorecase'}) { } 0 0 0
377 0 @abb = grep { /(?i)^$argv->[0]/ } keys %{$self->{'parameter'}};
378 } else {
379 0 @abb = grep { /^$argv->[0]/ } keys %{$self->{'parameter'}};
380 }
381 #Ok, now check to see if it's a valid 'switchglomming' parameter.
382 0 ▶ unless (($self->{'prefs'}->{'abbreviations'}) and @abb) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"prefs"}{"abbreviations"} and @abb) 0 0 0
Condition0%0/3
$self->{"prefs"}{"abbreviations"} and @abb
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"prefs"}{"abbreviations"} and @abb
$self->{"prefs"}{"abbreviations"} @abb
Truth table0%0/3
A and B
A= $self->{"prefs"}{"abbreviations"}B= @abb
ABresult
0X0
100
111
383 0 $argv->[0] =~ /^-([a-zA-Z0-9]+)$/;
384 0 ▶ my($arg) = ($self->{'prefs'}->{'ignorecase'})? lc($1) : $1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'prefs'}{'ignorecase'} ? : 0 0 0
385 #This bit of code makes sure that each letter of the potential switchglom is
386 # a defined switch or alias for a swich. Actually, any user-defined type that has
387 # 0 arguments can be enabled through this switchglom mechanism.
388 0 my($sg) = {};
389 0 foreach ( split(//, $arg) ) {
390 0 ▶ if (exists $self->{'aliasnamehash'}->{$_}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{'aliasnamehash'}{$_}) { } 0 0 0
elsif (exists $self->{'parameter'}{$_}) { } 0 0 0
391 $sg->{$_} = 1
392 if ($self->{'types'}->
393 {$self->{'parameter'}->{$self->{'aliasnamehash'}->{$_}}->{'type'}->[0]}->
394 0 ▶ {'number_of_arguments'} == 0);
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"types"}{$self->{"parameter"}{$self->{"aliasnamehash"}{$_}}{"type"}[0]}{"number_of_arguments"} == 0 0 0 0
395 } elsif (exists $self->{'parameter'}->{$_}) {
396 $sg->{$_} = 1
397 if ($self->{'types'}->
398 {$self->{'parameter'}->{$_}->{'type'}->[0]}->
399 0 ▶ {'number_of_arguments'} == 0);
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"types"}{$self->{"parameter"}{$_}{"type"}[0]}{"number_of_arguments"} == 0 0 0 0
400 }
401 }
402 0 ▶ if ((scalar keys %{$sg}) == length($arg)) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %{$sg;} == length $arg) 0 0 0
403 0 foreach ( keys %{$sg} ) {
404 0 ▶ if ((exists $self->{'aliasnamehash'}->{$_}) or (exists $self->{'parameter'}->{$_})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"aliasnamehash"}{$_} or exists $self->{"parameter"}{$_}) 0 0 0
Condition0%0/3
exists $self->{"aliasnamehash"}{$_} or exists $self->{"parameter"}{$_}
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $self->{"aliasnamehash"}{$_} or exists $self->{"parameter"}{$_}
exists $self->{"aliasnamehash"}{$_} exists $self->{"parameter"}{$_}
Truth table0%0/3
A or B
A= exists $self->{"aliasnamehash"}{$_}B= exists $self->{"parameter"}{$_}
ABresult
1X1
011
000
405 0 delete $sg->{$_};
406 }
407 }
408 #If no keys left in %sg, then switchglomming found a successful match
409 0 ▶ if ((scalar keys %{$sg}) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %{$sg;} == 0) 0 0 0
410 0 foreach my $switch ( split(//, $arg) ) {
411 0 ▶ if (exists $self->{'parameter'}->{$switch}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'parameter'}{$switch}) { } 0 0 0
412 $self->{'OPT'}->{$switch} =
413 0 $self->{'types'}->{$self->{'parameter'}->{$switch}->{'type'}->[0]}->{'specifiedvalue'};
414 0 ++$self->{'stats'}->{$switch};
415 } else {
416 $self->{'OPT'}->{$self->{'aliasnamehash'}->{$switch}} =
417 0 $self->{'types'}->{$self->{'parameter'}->{$self->{'aliasnamehash'}->{$switch}}->{'type'}->[0]}->{'specifiedvalue'};
418 0 ++$self->{'stats'}->{$self->{'aliasnamehash'}->{$switch}};
419 }
420 }
421 0 shift(@{$argv}); #remove switchglom from command line argument list
422 }
423 }
424 }
425 }
426  
427 #Loop through options and parse according to $self
428 0 my($i) = 0;
429 0 ▶ while ($i < @{$argv}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @{$argv;}) 0 0 0
430  
431 #Check for 'ignorecase'
432 0 ▶ my($cur_argv) = ($self->{'prefs'}->{'ignorecase'})? lc($argv->[$i]) : $argv->[$i];
Branch: 1 branch
BranchTrueFalseTotal
$self->{'prefs'}{'ignorecase'} ? : 0 0 0
433  
434 #Parse option
435 0 my($origParameter) = $argv->[$i];
436 0 my($parameter) = $origParameter;
437 0 $parameter =~ s/^-//;
438
439 #At this point, determine the correctly capitalized parameter if ignorecase
440 0 ▶ if ($self->{'prefs'}->{'ignorecase'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"ignorecase"}) 0 0 0
441 0 my($a) = [ grep { lc($parameter) eq lc($_) } keys %{$self->{'parameter'}} ];
442 0 ▶ if (@{$a} > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$a;} > 0) 0 0 0
443 0 $parameter = $a->[0];
444 }
445 }
446  
447 #Call help routine if $parameter is now '-help'
448 0 ▶ if ($parameter =~ /(?i)^\-?h(e(l(p)?)?)?$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($parameter =~ /(?i)^\-?h(e(l(p)?)?)?$/) { } 0 0 0
elsif ($parameter =~ /(?i)^\-?full_h(e(l(p)?)?)?$/) { } 0 0 0
449 0 $self->{'actions'}->{'help'} = 1;
450 0 $i++;
451 0 next;
452 #Call full_help routine if $parameter is now '-help'
453 } elsif ($parameter =~ /(?i)^\-?full_h(e(l(p)?)?)?$/) {
454 0 $self->{'actions'}->{'help'} = 2;
455 0 $i++;
456 0 next;
457 }
458  
459 #Store croak message
460 0 my($croak) = '';
461  
462 #Make sure this option exists. First see if it's a defined parameter,
463 # then see if it's an alias, then see if it's an abbreviation.
464 0 ▶ if (not exists $self->{'parameter'}->{$parameter}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"parameter"}{$parameter}) 0 0 0
465 0 ▶ if (exists $self->{'aliasnamehash'}->{$parameter}) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $self->{'aliasnamehash'}{$parameter}) { } 0 0 0
elsif ($self->{'prefs'}{'abbreviations'}) { } 0 0 0
466 0 $parameter = $self->{'aliasnamehash'}->{$parameter};
467 } elsif ($self->{'prefs'}->{'abbreviations'}) {
468 0 ▶ my(@args) = grep { ($parameter =~ /^\W/)? /^\\$parameter/ : /^$parameter/ } keys %{$self->{'parameter'}};
Branch: 1 branch
BranchTrueFalseTotal
$parameter =~ /^\W/ ? : 0 0 0
469 0 ▶ if (@args == 1) {
Branch: 3 branches
BranchTrueFalseTotal
if (@args == 1) { } 0 0 0
elsif (@args == 0) { } 0 0 0
elsif (@args > 1) { } 0 0 0
470 0 ▶ if (exists $self->{'parameter'}->{$args[0]}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'parameter'}{$args[0]}) { } 0 0 0
471 0 $parameter = $args[0];
472 } else {
473 0 $croak = "Unknown option (-$parameter)";
474 }
475 } elsif (@args == 0) {
476 0 $croak = "Unknown option (-$parameter)";
477 } elsif (@args > 1) {
478 0 $croak = "Ambiguous option (-$parameter) matches @args";
479 }
480 } else {
481 0 $croak = "Unknown option (-$parameter)";
482 }
483 }
484  
485 0 ▶ if ( length($croak) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $croak) 0 0 0
486 0 undef $parameter;
487 #If $croak is not empty, then no match was found on parameters,
488 # so check special parameters.
489 0 ▶ if (exists $self->{'special'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"special"}) 0 0 0
490 0 foreach my $sp ( keys %{$self->{'special'}} ) {
491 0 ▶ if (($cur_argv =~ /$self->{'special'}->{$sp}->{'special_pattern'}/) or
Branch: 1 branch
BranchTrueFalseTotal
if ($cur_argv =~ /$self->{"special"}{$sp}{"special_pattern"}/ or $cur_argv =~ /(?i)$self->{"special"}{$sp}{"special_pattern"}/ and $self->{"prefs"}{"ignorecase"}) 0 0 0
Condition0%0/6
$cur_argv =~ /$self->{"special"}{$sp}{"special_pattern"}/ or $cur_argv =~ /(?i)$self->{"special"}{$sp}{"special_pattern"}/ and $self->{"prefs"}{"ignorecase"}
l!l&&r!l&&!r
000
$cur_argv =~ /(?i)$self->{"special"}{$sp}{"special_pattern"}/ and $self->{"prefs"}{"ignorecase"}
!ll&&!rl&&r
000
MC/DC0%0/3
$cur_argv =~ /$self->{"special"}{$sp}{"special_pattern"}/ or $cur_argv =~ /(?i)$self->{"special"}{$sp}{"special_pattern"}/ and $self->{"prefs"}{"ignorecase"}
$cur_argv =~ /$self->{"special"}{$sp}{"special_pattern"}/ $cur_argv =~ /(?i)$self->{"special"}{$sp}{"special_pattern"}/ $self->{"prefs"}{"ignorecase"}
Truth table0%0/4
A or B and C
A= $cur_argv =~ /$self->{"special"}{$sp}{"special_pattern"}/B= $cur_argv =~ /(?i)$self->{"special"}{$sp}{"special_pattern"}/C= $self->{"prefs"}{"ignorecase"}
ABCresult
1XX1
0111
00X0
0100
492 (($cur_argv =~ /(?i)$self->{'special'}->{$sp}->{'special_pattern'}/) and ($self->{'prefs'}->{'ignorecase'}))) {
493 0 $parameter = $sp;
494 0 last;
495 }
496 }
497 }
498  
499 #When at this point, assume argument is a file
500 0 ▶ if (not defined $parameter) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $parameter) 0 0 0
501 0 ▶ if ($argv->[$i] !~ /^-/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($argv->[$i] =~ /^-/) 0 0 0
502 croak "File list not permitted (starting at '$argv->[$i]')"
503 0 ▶ unless (($self->{'prefs'}->{'filelist'} > -1) or ($self->{'prefs'}->{'intermingledFiles'} == 1));
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"prefs"}{"filelist"} > -1 or $self->{"prefs"}{"intermingledFiles"} == 1 0 0 0
Condition0%0/3
$self->{"prefs"}{"filelist"} > -1 or $self->{"prefs"}{"intermingledFiles"} == 1
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{"prefs"}{"filelist"} > -1 or $self->{"prefs"}{"intermingledFiles"} == 1
$self->{"prefs"}{"filelist"} > -1 $self->{"prefs"}{"intermingledFiles"} == 1
Truth table0%0/3
A or B
A= $self->{"prefs"}{"filelist"} > -1B= $self->{"prefs"}{"intermingledFiles"} == 1
ABresult
1X1
011
000
504 0 ▶ if ($self->{'prefs'}->{'intermingledFiles'} == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'prefs'}{'intermingledFiles'} == 1) { } 0 0 0
505 0 push(@{$self->{'OPT'}->{'filelist'}}, $argv->[$i]);
506 0 ++$i;
507 0 next;
508 } else {
509 0 push(@{$self->{'OPT'}->{'filelist'}}, @{$argv}[$i..$#{$argv}]);
510 0 last;
511 }
512 }
513 #Croak if $croak
514 0 ▶ croak $croak if length($croak);
Branch: 1 branch
BranchTrueFalseTotal
if length $croak 0 0 0
515 }
516 }
517  
518 #Determine parameter or special parameter
519 0 my($pKind) = (grep { exists $self->{$_}->{$parameter} } ('parameter', 'special',))[0];
520  
521 #Handle argumentFile types here
522 0 ▶ if ($self->{$pKind}->{$parameter}->{'type'}->[0] eq 'argumentFile') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{$pKind}{$parameter}{"type"}[0] eq "argumentFile") 0 0 0
523 0 my($file) = $argv->[$i+1];
524 my($pat) = (exists $self->{$pKind}->{$parameter}->{'argumentFileComment'})?
525 0 ▶ '(' . join('|', @{$self->{$pKind}->{$parameter}->{'argumentFileComment'}}) . ')' : '';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{$pKind}{$parameter}{'argumentFileComment'} ? : 0 0 0
526 0 ▶ open(AF, "< $file") or croak "Unable to open file $file for reading.\n\n";
Branch: 1 branch
BranchTrueFalseTotal
open AF, "< $file" or croak("Unable to open file $file for reading.\n\n") 0 0 0
527 0 my($argStrArr) = [ 0 ];
528 0 ▶ while (<AF>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline AF)) 0 0 0
529 0 chomp;
530 0 ▶ s/$pat.*$// if length($pat);
Branch: 1 branch
BranchTrueFalseTotal
if length $pat 0 0 0
531 0 ▶ next if /^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
if /^\s*$/ 0 0 0
532 0 push(@{$argStrArr}, $_);
533 }
534 0 close AF;
535 0 my(@args) = `perl -e 'print join(\"\\n\", \@ARGV), \"\\n\";' @{$argStrArr}`;
536 0 chomp(@args);
537 0 splice(@{$argv}, $i, 2, @args);
538 0 splice(@{$argv}, $i, 1);
539 0 $i -= 2;
540 }
541  
542 #Count parameter instances
543 0 ++$self->{'stats'}->{$parameter};
544  
545 #Assign value into $self->{'OPT'}:
546 #Handle special case of type that has no arguments (like type 'switch')
547 0 ▶ if ($self->{'types'}->{$self->{$pKind}->{$parameter}->{'type'}->[0]}->{'number_of_arguments'} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'types'}{$self->{$pKind}{$parameter}{'type'}[0]}{'number_of_arguments'} == 0) { } 0 0 0
548 0 ▶ if ($pKind eq 'parameter') {
Branch: 1 branch
BranchTrueFalseTotal
if ($pKind eq 'parameter') { } 0 0 0
549 $self->{'OPT'}->{$parameter} =
550 0 $self->{'types'}->{$self->{$pKind}->{$parameter}->{'type'}->[0]}->{'specifiedvalue'};
551 } else {
552 #since this is a 'special', check pattern and store $1 if it exists
553 0 $argv->[$i] =~ /$self->{'special'}->{$parameter}->{'special_pattern'}/;
554 0 ▶ if (defined $1) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $1) { } 0 0 0
555 0 push(@{$self->{'OPT'}->{$parameter}}, [ $1 ]);
556 } else {
557 0 push(@{$self->{'OPT'}->{$parameter}}, [ $argv->[$i] ]);
558 }
559 }
560 } else {
561 0 my($args) = [];
562 0 foreach my $typeIndex ( 0 .. $#{$self->{$pKind}->{$parameter}->{'type'}} ) {
563 0 my($type) = $self->{$pKind}->{$parameter}->{'type'}->[$typeIndex];
564 0 ▶ croak "Not enough arguments for '$parameter'" unless ($i < $#{$argv});
Branch: 1 branch
BranchTrueFalseTotal
unless $i < $#{$argv;} 0 0 0
565 0 my($arg) = $argv->[++$i];
566 #Check type specifications first
567 0 ▶ if (exists $self->{'types'}->{$type}->{'arguments'}->[0]->{'pattern'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"types"}{$type}{"arguments"}[0]{"pattern"}) 0 0 0
568 0 foreach my $p ( @{$self->{'types'}->{$type}->{'arguments'}->[0]->{'pattern'}} ) {
569 croak join('', "Bad $type value ($arg) for parameter '$parameter'",
570 0 ▶ (($pKind eq 'special')? '('.$argv->[$i-@{$args}-1].')' : ''))
Branch: 2 branches
BranchTrueFalseTotal
unless $arg =~ /$p/ 0 0 0
$pKind eq 'special' ? : 0 0 0
571 if ($arg !~ /$p/);
572 }
573 }
574 #Now check parameter specifications
575 0 ▶ if ((exists $self->{$pKind}->{$parameter}) and
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{$pKind}{$parameter} and exists $self->{$pKind}{$parameter}{"pattern"}) 0 0 0
Condition0%0/3
exists $self->{$pKind}{$parameter} and exists $self->{$pKind}{$parameter}{"pattern"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{$pKind}{$parameter} and exists $self->{$pKind}{$parameter}{"pattern"}
exists $self->{$pKind}{$parameter} exists $self->{$pKind}{$parameter}{"pattern"}
Truth table0%0/3
A and B
A= exists $self->{$pKind}{$parameter}B= exists $self->{$pKind}{$parameter}{"pattern"}
ABresult
0X0
100
111
576 (exists $self->{$pKind}->{$parameter}->{'pattern'})) {
577 0 foreach my $pat ( @{$self->{$pKind}->{$parameter}->{'pattern'}->[$#{$args}+1]} ) {
578 croak join('', "Bad $type value ($arg) for parameter '$parameter'",
579 0 ▶ (($pKind eq 'special')? '('.$argv->[$i-@{$args}-1].')' : ''))
Branch: 2 branches
BranchTrueFalseTotal
unless $arg =~ /$pat/ 0 0 0
$pKind eq 'special' ? : 0 0 0
580 if ($arg !~ /$pat/);
581 }
582 }
583 #Now check for key match if keys defined
584 0 ▶ if ((exists $self->{$pKind}->{$parameter}) and
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{$pKind}{$parameter} and exists $self->{$pKind}{$parameter}{"keys"} and defined $self->{$pKind}{$parameter}{"keys"}[$typeIndex]) 0 0 0
Condition0%0/6
exists $self->{$pKind}{$parameter} and exists $self->{$pKind}{$parameter}{"keys"} and defined $self->{$pKind}{$parameter}{"keys"}[$typeIndex]
!ll&&!rl&&r
000
exists $self->{$pKind}{$parameter} and exists $self->{$pKind}{$parameter}{"keys"}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $self->{$pKind}{$parameter} and exists $self->{$pKind}{$parameter}{"keys"} and defined $self->{$pKind}{$parameter}{"keys"}[$typeIndex]
exists $self->{$pKind}{$parameter} exists $self->{$pKind}{$parameter}{"keys"} defined $self->{$pKind}{$parameter}{"keys"}[$typeIndex]
Truth table0%0/4
A and B and C
A= exists $self->{$pKind}{$parameter}B= exists $self->{$pKind}{$parameter}{"keys"}C= defined $self->{$pKind}{$parameter}{"keys"}[$typeIndex]
ABCresult
0XX0
10X0
1100
1111
585 (exists $self->{$pKind}->{$parameter}->{'keys'}) and
586 (defined $self->{$pKind}->{$parameter}->{'keys'}->[$typeIndex])) {
587 croak join('', "Bad value ($arg) for parameter '$parameter'",
588 (exists $self->{$pKind}->{$parameter}->{'name'})?
589 ", subParameter '$self->{$pKind}->{$parameter}->{'name'}->[$typeIndex]'" : '',
590 ". Valid values are (",
591 0 join(', ', @{$self->{$pKind}->{$parameter}->{'keys'}->[$typeIndex]}), ")")
592 0 ▶ unless (exists { map { $_, 1 } @{$self->{$pKind}->{$parameter}->{'keys'}->[$typeIndex]} }->{$arg});
Branch: 2 branches
BranchTrueFalseTotal
unless exists {map({$_, 1;} @{$$self{$pKind}{$parameter}{"keys"}[$typeIndex];})}->{$arg} 0 0 0
exists $self->{$pKind}{$parameter}{'name'} ? : 0 0 0
593 }
594  
595 0 push(@{$args}, $arg);
596 0 $self->{$pKind}->{$parameter}->{'values'}->{$arg} = 1;
597 }
598  
599 0 my($vals) = {};
600 0 ▶ if ((exists $self->{'OPT'}->{$parameter}) and (ref($self->{'OPT'}->{$parameter}) eq 'ARRAY')) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"OPT"}{$parameter} and ref $self->{"OPT"}{$parameter} eq "ARRAY") 0 0 0
Condition0%0/3
exists $self->{"OPT"}{$parameter} and ref $self->{"OPT"}{$parameter} eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"OPT"}{$parameter} and ref $self->{"OPT"}{$parameter} eq "ARRAY"
exists $self->{"OPT"}{$parameter} ref $self->{"OPT"}{$parameter} eq "ARRAY"
Truth table0%0/3
A and B
A= exists $self->{"OPT"}{$parameter}B= ref $self->{"OPT"}{$parameter} eq "ARRAY"
ABresult
0X0
100
111
601 0 foreach ( @{$self->{'OPT'}->{$parameter}} ) {
602 0 $vals->{"@{$_}"} = 1;
603 }
604 }
605  
606 0 ▶ if ($pKind eq 'parameter') {
Branch: 1 branch
BranchTrueFalseTotal
if ($pKind eq 'parameter') { } 0 0 0
607 0 push(@{$self->{'OPT'}->{$parameter}}, $args);
608 } else {
609 0 push(@{$self->{'OPT'}->{$parameter}}, [ $argv->[$i-@{$args}], @{$args} ]);
610 }
611  
612 #Do unique check here
613 0 croak "Duplicate arguments '@{$self->{'OPT'}->{$parameter}->[$#{$self->{'OPT'}->{$parameter}}]}' found for option '$parameter' which requries unique arguments"
614 0 ▶ if (($self->{$pKind}->{$parameter}->{'unique'}) and (exists $vals->{"@{$self->{'OPT'}->{$parameter}->[$#{$self->{'OPT'}->{$parameter}}]}"}));
Branch: 1 branch
BranchTrueFalseTotal
if $self->{$pKind}{$parameter}{"unique"} and exists $$vals{join $", @{$self->{"OPT"}{$parameter}[$#{$$self{"OPT"}{$parameter};}];}} 0 0 0
Condition0%0/3
$self->{$pKind}{$parameter}{"unique"} and exists $$vals{join $", @{$self->{"OPT"}{$parameter}[$#{$$self{"OPT"}{$parameter};}];}}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{$pKind}{$parameter}{"unique"} and exists $$vals{join $", @{$self->{"OPT"}{$parameter}[$#{$$self{"OPT"}{$parameter};}];}}
$self->{$pKind}{$parameter}{"unique"} exists $$vals{join $", @{$self->{"OPT"}{$parameter}[$#{$$self{"OPT"}{$parameter};}];}}
Truth table0%0/3
A and B
A= $self->{$pKind}{$parameter}{"unique"}B= exists $$vals{join $", @{$self->{"OPT"}{$parameter}[$#{$$self{"OPT"}{$parameter};}];}}
ABresult
0X0
100
111
615  
616 }
617 0 ++$i;
618 }
619  
620 #Do all argument checking here (prior to default bindings) unless help is requested
621 0 ▶ if ($self->{'actions'}->{'help'} == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"actions"}{"help"} == 0) 0 0 0
622 #Check for mutual exclusion
623 0 ▶ if (exists $self->{'checks'}->{'mutex'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"checks"}{"mutex"}) 0 0 0
624 0 foreach my $mutex ( @{$self->{'checks'}->{'mutex'}} ) {
625 0 my($set) = [ grep { exists $self->{'stats'}->{$_} } @{$mutex} ];
626 croak "Invalid argument set. The following options are mutually exclusive: " .
627 0 ▶ join(', ', @{$set}) if (@{$set} > 1);
Branch: 1 branch
BranchTrueFalseTotal
if @{$set;} > 1 0 0 0
628 }
629 }
630 #Check for required arguments
631 0 foreach my $p ( keys %{$self->{'parameter'}} ) {
632 croak "Required parameter '$p' not specified"
633 0 ▶ if ($self->{'parameter'}->{$p}->{'required'} and (not exists $self->{'OPT'}->{$p}));
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"parameter"}{$p}{"required"} and not exists $self->{"OPT"}{$p} 0 0 0
Condition0%0/3
$self->{"parameter"}{$p}{"required"} and not exists $self->{"OPT"}{$p}
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"parameter"}{$p}{"required"} and not exists $self->{"OPT"}{$p}
$self->{"parameter"}{$p}{"required"} not exists $self->{"OPT"}{$p}
Truth table0%0/3
A and not(B)
A= $self->{"parameter"}{$p}{"required"}B= not exists $self->{"OPT"}{$p}
ABresult
0X0
100
111
634 }
635 #Check for req_grps
636 0 ▶ if (exists $self->{'checks'}->{'req_grp'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"checks"}{"req_grp"}) 0 0 0
637 0 foreach my $req_grp ( @{$self->{'checks'}->{'req_grp'}} ) {
638 0 my($set) = [ grep { exists $self->{'stats'}->{$_} } @{$req_grp} ];
639 croak "Invalid argument set. The following options must be used together: " .
640 0 ▶ join(', ', @{$req_grp}) if ((@{$set} != 0) and (@{$set} != @{$req_grp}));
Branch: 1 branch
BranchTrueFalseTotal
if @{$set;} != 0 and @{$set;} != @{$req_grp;} 0 0 0
Condition0%0/3
@{$set;} != 0 and @{$set;} != @{$req_grp;}
!ll&&!rl&&r
000
MC/DC0%0/2
@{$set;} != 0 and @{$set;} != @{$req_grp;}
@{$set;} != 0 @{$set;} != @{$req_grp;}
Truth table0%0/3
A and B
A= @{$set;} != 0B= @{$set;} != @{$req_grp;}
ABresult
0X0
100
111
641 }
642 }
643 }
644  
645 #Loop through all parameters to see if they've been defined, and if not,
646 # assign default values if they exist.
647 0 foreach my $p ( keys %{$self->{'parameter'}} ) {
648 0 ▶ next if (exists $self->{'OPT'}->{$p});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"OPT"}{$p} 0 0 0
649 #Assign 'unspecified' values to any parameters w/ zero arguments that weren't specified
650 0 ▶ if ($self->{'types'}->{$self->{'parameter'}->{$p}->{'type'}->[0]}->{'number_of_arguments'} == 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'types'}{$self->{'parameter'}{$p}{'type'}[0]}{'number_of_arguments'} == 0) { } 0 0 0
elsif ($self->{'types'}{$self->{'parameter'}{$p}{'type'}[0]}{'number_of_arguments'} == 1) { } 0 0 0
651 0 $self->{'OPT'}->{$p} = $self->{'types'}->{$self->{'parameter'}->{$p}->{'type'}->[0]}->{'unspecifiedvalue'};
652 } elsif ($self->{'types'}->{$self->{'parameter'}->{$p}->{'type'}->[0]}->{'number_of_arguments'} == 1) {
653 0 @{$self->{'OPT'}->{$p}} = @{$self->{'parameter'}->{$p}->{'default'}}
654 0 ▶ if (exists $self->{'parameter'}->{$p}->{'default'});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"parameter"}{$p}{"default"} 0 0 0
655 }
656 }
657  
658 #If -help was specified, print help and quit
659 &__print_help($self, $argv, $self->{'actions'}->{'help'})
660 0 ▶ if ((exists $self->{'actions'}->{'help'}) and ($self->{'actions'}->{'help'} > 0));
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"actions"}{"help"} and $self->{"actions"}{"help"} > 0 0 0 0
Condition0%0/3
exists $self->{"actions"}{"help"} and $self->{"actions"}{"help"} > 0
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{"actions"}{"help"} and $self->{"actions"}{"help"} > 0
exists $self->{"actions"}{"help"} $self->{"actions"}{"help"} > 0
Truth table0%0/3
A and B
A= exists $self->{"actions"}{"help"}B= $self->{"actions"}{"help"} > 0
ABresult
0X0
100
111
661  
662 }
663  
664 #### Method: parameter
665 #######################################################################
666 # Routine to define a parameter
667 #######################################################################
668 23 ▶sub _parameter {
Subroutine _parameter: called CC=11 SCAR=33.5
669 23 my($self) = shift;
670 23 ▶ if (@_ == 1) {
Branch: 3 branches
BranchTrueFalseTotal
if (@_ == 1) { } 17 6 23
elsif ($_[1] eq 'switches') { } 0 6 6
elsif (ref $_[1] eq 'HASH') { } 0 6 6
671 17 ▶ if (ref($_[0]) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'HASH') { } 0 17 17
672 0 foreach my $p ( keys %{$_[0]} ) {
673 0 &__assign_parameter($self, $p, $_[0]->{$p});
674 }
675 } else {
676 17 &__assign_parameter($self, $_[0], 'switch');
677 }
678 } elsif ($_[1] eq 'switches') {
679 0 foreach my $p ( split(//, $_[0]) ) {
680 0 &__assign_parameter($self, $p, 'switch');
681 }
682 #parameter properties passed in as a hash: { 'type' => 'integer', }
683 } elsif (ref($_[1]) eq 'HASH') {
684 #make sure type is specified in HASH
685 0 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 0 0 0
686 croak "'type' must be specified in HASH passed to _parameter method"
687 0 ▶ unless ($_[1]->{'type'});
Branch: 1 branch
BranchTrueFalseTotal
unless $_[1]{"type"} 0 0 0
688 }
689 #do 'type' first, then do other properties ('default', 'alias', etc.)
690 0 &_type($self, $_[0], $_[1]->{'type'});
691 0 foreach my $prop ( grep { !/^type$/ } keys %{$_[1]} ) {
692 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
693 0 &{"_$prop"}($self, $_[0], $_[1]->{$prop});
694 }
695 } else {
696 6 my($p) = shift;
697 6 my($t) = shift;
698 6 &__assign_parameter($self, $p, $t);
699 6 ▶ &_alias($self, $p, @_) if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 2 4 6
700 }
701 }
702 6 ▶sub _p { &_parameter(@_); }
Subroutine _p: called CC=1 SCAR=0.0
703  
704 #### Method: required_parameter
705 #######################################################################
706 # Routine to define a required parameter
707 #######################################################################
708 0 ▶sub _requiredParameter { &_required_parameter(@_); }
Subroutine _requiredParameter: not called CC=1 SCAR=6.9
709 0 ▶sub _required_parameter {
Subroutine _required_parameter: not called CC=1 SCAR=6.9
710 0 &_parameter(@_);
711 0 &_required(@_);
712 }
713 0 ▶sub _reqp { &_required_parameter(@_); }
Subroutine _reqp: not called CC=1 SCAR=6.9
714 0 ▶sub _rp { &_required_parameter(@_); }
Subroutine _rp: not called CC=1 SCAR=6.9
715  
716 #######################################################################
717 # Routine to define a type for a specified parameter
718 #######################################################################
719 0 ▶sub _type { &__assign_parameter(@_); }
Subroutine _type: not called CC=1 SCAR=6.9
720 0 ▶sub _t { &_type(@_); }
Subroutine _t: not called CC=1 SCAR=6.9
721  
722 #######################################################################
723 # Routine to create hash for specified parameter
724 #######################################################################
725 23 ▶sub __assign_parameter {
Subroutine __assign_parameter: called CC=7 SCAR=20.2
726 23 my($self, $parameter, $type) = @_;
727 23 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 23 0 23
728 #Check to make sure that parameter is a scalar
729 23 ▶ croak "Inappropriate parameter identifier '$parameter'" if ref($parameter);
Branch: 1 branch
BranchTrueFalseTotal
if ref $parameter 0 23 23
730 #Check to make sure that parameter of that same name doesn't already exit
731 croak "Multiply defined parameter '$parameter'"
732 23 ▶ if (exists $self->{'parameter'}->{$parameter});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"parameter"}{$parameter} 0 23 23
733 #Check to make sure that the specified type exists
734 croak "Unknown type '$type' cannot be used by option '$parameter'"
735 23 ▶ unless (exists $self->{'types'}->{$type});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"types"}{$type} 0 23 23
736 #Make sure parameter is not defined as an alias for an existing parameter
737 23 foreach my $a ( %{$self->{'aliasnamehash'}} ) {
738 croak "Invalid parameter '$parameter': already defined as an alias for '$self->{'aliasnamehash'}->{$parameter}'"
739 28 ▶ if (exists $self->{'aliasnamehash'}->{$parameter});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"aliasnamehash"}{$parameter} 0 28 28
740 }
741 }
742 23 $self->{'parameter'}->{$parameter} = { 'type' => [$type], 'unique' => [0], };
743 23 $self->{'parameter'}->{$parameter}->{'required'} = 0;
744 23 $self->{'parameter'}->{$parameter}->{'unique'} = 0;
745 23 $self->{'parameter'}->{$parameter}->{'_ptype'} = 'single';
746  
747 23 &__ooRoutines($self, $parameter);
748 }
749  
750 #### Method: multi_parameter
751 #######################################################################
752 # Routine to define a parameter w/ multiple arguments
753 #######################################################################
754 1 ▶sub _mp { &_multi_parameter(@_); }
Subroutine _mp: called CC=1 SCAR=0.0
755 0 ▶sub _multiParameter { &_multi_parameter(@_); }
Subroutine _multiParameter: not called CC=1 SCAR=6.9
756 3 ▶sub _multi_parameter {
Subroutine _multi_parameter: called CC=9 SCAR=22.5
757 3 my($self) = shift;
758 3 my($parameter) = shift;
759 3 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 3 0 3
760 3 ▶ carp "Calling multi_parameter w/ only one named subparameter" if (@_ == 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 0 3 3
761 }
762 3 $self->{'parameter'}->{$parameter}->{'required'} = 0;
763 3 $self->{'parameter'}->{$parameter}->{'unique'} = 0;
764 3 $self->{'parameter'}->{$parameter}->{'_ptype'} = 'multi';
765 3 foreach my $mp ( @_ ) {
766 7 ▶ croak "Call to multi_parameter must have HASH references as arguments"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $mp eq "HASH" 0 7 7
767 unless (ref($mp) eq 'HASH');
768 croak "Call to multi_parameter must have HASH references w/ only one key"
769 7 ▶ unless ((scalar keys %{$mp}) == 1);
Branch: 1 branch
BranchTrueFalseTotal
unless scalar keys %{$mp;} == 1 0 7 7
770 7 my($name) = (keys %{$mp})[0];
771 7 my($type) = $mp->{$name};
772 7 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 7 0 7
773 croak "Multiply defined subparameter '$name' in declaration of '$parameter'"
774 7 ▶ if (exists $self->{'parameter'}->{$parameter}->{'nameOrder'}->{$name});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"parameter"}{$parameter}{"nameOrder"}{$name} 0 7 7
775 croak "Unknown type '$type' cannot be used by option '$parameter:$name'"
776 7 ▶ unless (exists $self->{'types'}->{$type});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"types"}{$type} 0 7 7
777 }
778 7 push(@{$self->{'parameter'}->{$parameter}->{'type'}}, $type);
779 7 push(@{$self->{'parameter'}->{$parameter}->{'name'}}, $name);
780 $self->{'parameter'}->{$parameter}->{'nameOrder'}->{$name} =
781 7 $#{$self->{'parameter'}->{$parameter}->{'name'}};
782 }
783 3 &__ooRoutines($self, $parameter);
784 }
785  
786 #### Method: required_multi_parameter
787 #######################################################################
788 # Routine to define a required multi parameter
789 #######################################################################
790 0 ▶sub _requiredMultiParameter { &_required_multi_parameter(@_); }
Subroutine _requiredMultiParameter: not called CC=1 SCAR=6.9
791 0 ▶sub _required_multi_parameter {
Subroutine _required_multi_parameter: not called CC=1 SCAR=6.9
792 0 &_multi_parameter(@_);
793 0 &_required(@_);
794 }
795 0 ▶sub _rmp { &_required_multi_parameter(@_); }
Subroutine _rmp: not called CC=1 SCAR=6.9
796  
797 #### Method: multi_special
798 #######################################################################
799 # Routine to define a special w/ multiple arguments
800 #######################################################################
801 0 ▶sub _multiSpecial { &_multi_special(@_); }
Subroutine _multiSpecial: not called CC=1 SCAR=6.9
802 0 ▶sub _multiSpecialParameter { &_multi_special_parameter(@_); }
Subroutine _multiSpecialParameter: not called CC=1 SCAR=6.9
803 4 ▶sub _multi_special { &_multi_special_parameter(@_); }
Subroutine _multi_special: called CC=1 SCAR=0.0
804 4 ▶sub _multi_special_parameter {
Subroutine _multi_special_parameter: called CC=9 SCAR=22.5
805 4 my($self) = shift;
806 4 my($special) = shift;
807 4 my($special_pattern) = shift;
808 4 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 4 0 4
809 4 ▶ carp "Calling multi_special w/ only one named subparameter" if (@_ == 1);
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 0 4 4
810 }
811 4 $self->{'special'}->{$special}->{'required'} = 0;
812 4 foreach my $mp ( @_ ) {
813 12 ▶ croak "Call to multi_special must have HASH references as arguments"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $mp eq "HASH" 0 12 12
814 unless (ref($mp) eq 'HASH');
815 croak "Call to multi_special must have HASH references w/ only one key"
816 12 ▶ unless ((scalar keys %{$mp}) == 1);
Branch: 1 branch
BranchTrueFalseTotal
unless scalar keys %{$mp;} == 1 0 12 12
817 12 my($name) = (keys %{$mp})[0];
818 12 my($type) = $mp->{$name};
819 12 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 12 0 12
820 croak "Multiply defined subparameter '$name' in declaration of '$special'"
821 12 ▶ if (exists $self->{'special'}->{$special}->{'nameOrder'}->{$name});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"special"}{$special}{"nameOrder"}{$name} 0 12 12
822 croak "Unknown type '$type' cannot be used by option '$special:$name'"
823 12 ▶ unless (exists $self->{'types'}->{$type});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"types"}{$type} 0 12 12
824 }
825 12 push(@{$self->{'special'}->{$special}->{'type'}}, $type);
826 12 push(@{$self->{'special'}->{$special}->{'name'}}, $name);
827 $self->{'special'}->{$special}->{'nameOrder'}->{$name} =
828 12 $#{$self->{'special'}->{$special}->{'name'}};
829 }
830 4 $self->{'special'}->{$special}->{'special_pattern'} = $special_pattern;
831 4 &__ooRoutines($self, $special);
832 }
833 0 ▶sub _ms { &_multi_special(@_); }
Subroutine _ms: not called CC=1 SCAR=6.9
834 0 ▶sub _msp { &_multi_special(@_); }
Subroutine _msp: not called CC=1 SCAR=6.9
835  
836 #### Method: special_parameter
837 #######################################################################
838 # Routine to define a special parameter
839 # sp(<name>, <pattern>)
840 # sp(<name>, <pattern>, <type>)
841 #######################################################################
842 0 ▶sub _specialParameter { &_special_parameter(@_); }
Subroutine _specialParameter: not called CC=1 SCAR=6.9
843 12 ▶sub _s { &_special_parameter(@_); }
Subroutine _s: called CC=1 SCAR=0.0
844 5 ▶sub _special { &_special_parameter(@_); }
Subroutine _special: called CC=1 SCAR=0.0
845 17 ▶sub _special_parameter {
Subroutine _special_parameter: called CC=4 SCAR=14.5
846 17 my($self) = shift;
847 17 ▶ croak "Wrong number of arguments in method call" if ((@_ < 2) or (@_ > 3));
Branch: 1 branch
BranchTrueFalseTotal
if @_ < 2 or @_ > 3 0 17 17
Condition33%1/3
@_ < 2 or @_ > 3
l!l&&r!l&&!r
0017
MC/DC0%0/2
@_ < 2 or @_ > 3
@_ < 2 @_ > 3
Truth table33%1/3
A or B
A= @_ < 2B= @_ > 3
ABresult
1X1
011
000
848 17 ▶ if (@_ == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 2) { } 9 8 17
849 9 &__assign_special_parameter($self, @_, 'switch');
850 } else {
851 8 &__assign_special_parameter($self, @_);
852 }
853 }
854  
855 #######################################################################
856 # Routine to create hash for specified special parameter
857 #######################################################################
858 17 ▶sub __assign_special_parameter {
Subroutine __assign_special_parameter: called CC=5 SCAR=17.3
859 17 my($self, $special, $pattern, $type) = @_;
860 17 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 17 0 17
861 #Check to make sure that parameter of that same name doesn't already exit
862 croak "Multiply defined parameter '$special'"
863 if ((exists $self->{'special'}->{$special}) or
864 17 ▶ (exists $self->{'parameter'}->{$special}));
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"special"}{$special} or exists $self->{"parameter"}{$special} 0 17 17
Condition33%1/3
exists $self->{"special"}{$special} or exists $self->{"parameter"}{$special}
l!l&&r!l&&!r
0017
MC/DC0%0/2
exists $self->{"special"}{$special} or exists $self->{"parameter"}{$special}
exists $self->{"special"}{$special} exists $self->{"parameter"}{$special}
Truth table33%1/3
A or B
A= exists $self->{"special"}{$special}B= exists $self->{"parameter"}{$special}
ABresult
1X1
011
000
865 #Check to make sure that the specified type exists
866 croak "Unknown type '$type' cannot be used by option '$special'"
867 17 ▶ unless (exists $self->{'types'}->{$type});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"types"}{$type} 0 17 17
868 }
869 17 $self->{'special'}->{$special}->{'required'} = 0;
870 17 $self->{'special'}->{$special}->{'unique'} = 0;
871 17 $self->{'special'}->{$special} = { 'special_pattern' => $pattern, 'type' => [ $type, ], };
872 17 &__ooRoutines($self, $special);
873 }
874  
875 #### Method: alias
876 #######################################################################
877 #Routine to associate an alias of set of aliases w/ a parameter
878 #######################################################################
879 47 ▶sub __ooRoutines {
Subroutine __ooRoutines: called CC=4 SCAR=29.7
880 47 my($self, $parameter) = @_;
881 47 ▶ if ($self->{'prefs'}->{'ooRoutines'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"ooRoutines"}) 47 0 47
882 47 my($code) = '';
883 $code = join('',
884 'sub ', (($parameter =~ /^\d/)? '_' : ''), $parameter,
885 ' { my($self)=shift; return($self->_arg( \'', $parameter, '\', @_)); }', "\n",
886 47 ▶ map { join('',
Branch: 2 branches
BranchTrueFalseTotal
$parameter =~ /^\d/ ? : 0 47 47
$parameter =~ /^\d/ ? : 0 376 376
887 'sub ', (($parameter =~ /^\d/)? '_' : ''), "${parameter}_$_",
888 ' { my($self)=shift; return($self->_', $_, '( \'', $parameter, '\', @_)); }', "\n",) }
889 qw/arge argt args argv argl argc arglprepare argh/);
890 # print "$code\n\n";
891 0 ▶ eval "$code";
Subroutine PAram05: not called CC=1 SCAR=6.9
Subroutine PAram05_argc: not called CC=1 SCAR=6.9
Subroutine PAram05_arge: not called CC=1 SCAR=6.9
Subroutine PAram05_argh: not called CC=1 SCAR=6.9
Subroutine PAram05_argl: not called CC=1 SCAR=6.9
Subroutine PAram05_arglprepare: not called CC=1 SCAR=6.9
Subroutine PAram05_args: not called CC=1 SCAR=6.9
Subroutine PAram05_argt: not called CC=1 SCAR=6.9
Subroutine PAram05_argv: not called CC=1 SCAR=6.9
Subroutine a: not called CC=1 SCAR=6.9
Subroutine aDefault: not called CC=1 SCAR=6.9
Subroutine aDefault_argc: not called CC=1 SCAR=6.9
Subroutine aDefault_arge: not called CC=1 SCAR=6.9
Subroutine aDefault_argh: not called CC=1 SCAR=6.9
Subroutine aDefault_argl: not called CC=1 SCAR=6.9
Subroutine aDefault_arglprepare: not called CC=1 SCAR=6.9
Subroutine aDefault_args: not called CC=1 SCAR=6.9
Subroutine aDefault_argt: not called CC=1 SCAR=6.9
Subroutine aDefault_argv: not called CC=1 SCAR=6.9
Subroutine aOption: not called CC=1 SCAR=6.9
Subroutine aOption_argc: not called CC=1 SCAR=6.9
Subroutine aOption_arge: not called CC=1 SCAR=6.9
Subroutine aOption_argh: not called CC=1 SCAR=6.9
Subroutine aOption_argl: not called CC=1 SCAR=6.9
Subroutine aOption_arglprepare: not called CC=1 SCAR=6.9
Subroutine aOption_args: not called CC=1 SCAR=6.9
Subroutine aOption_argt: not called CC=1 SCAR=6.9
Subroutine aOption_argv: not called CC=1 SCAR=6.9
Subroutine aRemoveOption: not called CC=1 SCAR=6.9
Subroutine aRemoveOption_argc: not called CC=1 SCAR=6.9
Subroutine aRemoveOption_arge: not called CC=1 SCAR=6.9
Subroutine aRemoveOption_argh: not called CC=1 SCAR=6.9
Subroutine aRemoveOption_argl: not called CC=1 SCAR=6.9
Subroutine aRemoveOption_arglprepare: not called CC=1 SCAR=6.9
Subroutine aRemoveOption_args: not called CC=1 SCAR=6.9
Subroutine aRemoveOption_argt: not called CC=1 SCAR=6.9
Subroutine aRemoveOption_argv: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch_argc: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch_arge: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch_argh: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch_argl: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch_arglprepare: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch_args: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch_argt: not called CC=1 SCAR=6.9
Subroutine aRemoveSwitch_argv: not called CC=1 SCAR=6.9
Subroutine aSwitch: not called CC=1 SCAR=6.9
Subroutine aSwitch_argc: not called CC=1 SCAR=6.9
Subroutine aSwitch_arge: not called CC=1 SCAR=6.9
Subroutine aSwitch_argh: not called CC=1 SCAR=6.9
Subroutine aSwitch_argl: not called CC=1 SCAR=6.9
Subroutine aSwitch_arglprepare: not called CC=1 SCAR=6.9
Subroutine aSwitch_args: not called CC=1 SCAR=6.9
Subroutine aSwitch_argt: not called CC=1 SCAR=6.9
Subroutine aSwitch_argv: not called CC=1 SCAR=6.9
Subroutine a_argc: not called CC=1 SCAR=6.9
Subroutine a_arge: not called CC=1 SCAR=6.9
Subroutine a_argh: not called CC=1 SCAR=6.9
Subroutine a_argl: not called CC=1 SCAR=6.9
Subroutine a_arglprepare: not called CC=1 SCAR=6.9
Subroutine a_args: not called CC=1 SCAR=6.9
Subroutine a_argt: not called CC=1 SCAR=6.9
Subroutine a_argv: not called CC=1 SCAR=6.9
Subroutine b: not called CC=1 SCAR=6.9
Subroutine bDefault: not called CC=1 SCAR=6.9
Subroutine bDefault_argc: not called CC=1 SCAR=6.9
Subroutine bDefault_arge: not called CC=1 SCAR=6.9
Subroutine bDefault_argh: not called CC=1 SCAR=6.9
Subroutine bDefault_argl: not called CC=1 SCAR=6.9
Subroutine bDefault_arglprepare: not called CC=1 SCAR=6.9
Subroutine bDefault_args: not called CC=1 SCAR=6.9
Subroutine bDefault_argt: not called CC=1 SCAR=6.9
Subroutine bDefault_argv: not called CC=1 SCAR=6.9
Subroutine bOption: not called CC=1 SCAR=6.9
Subroutine bOption_argc: not called CC=1 SCAR=6.9
Subroutine bOption_arge: not called CC=1 SCAR=6.9
Subroutine bOption_argh: not called CC=1 SCAR=6.9
Subroutine bOption_argl: not called CC=1 SCAR=6.9
Subroutine bOption_arglprepare: not called CC=1 SCAR=6.9
Subroutine bOption_args: not called CC=1 SCAR=6.9
Subroutine bOption_argt: not called CC=1 SCAR=6.9
Subroutine bOption_argv: not called CC=1 SCAR=6.9
Subroutine bRemoveOption: not called CC=1 SCAR=6.9
Subroutine bRemoveOption_argc: not called CC=1 SCAR=6.9
Subroutine bRemoveOption_arge: not called CC=1 SCAR=6.9
Subroutine bRemoveOption_argh: not called CC=1 SCAR=6.9
Subroutine bRemoveOption_argl: not called CC=1 SCAR=6.9
Subroutine bRemoveOption_arglprepare: not called CC=1 SCAR=6.9
Subroutine bRemoveOption_args: not called CC=1 SCAR=6.9
Subroutine bRemoveOption_argt: not called CC=1 SCAR=6.9
Subroutine bRemoveOption_argv: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch_argc: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch_arge: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch_argh: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch_argl: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch_arglprepare: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch_args: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch_argt: not called CC=1 SCAR=6.9
Subroutine bRemoveSwitch_argv: not called CC=1 SCAR=6.9
Subroutine bSwitch: not called CC=1 SCAR=6.9
Subroutine bSwitch_argc: not called CC=1 SCAR=6.9
Subroutine bSwitch_arge: not called CC=1 SCAR=6.9
Subroutine bSwitch_argh: not called CC=1 SCAR=6.9
Subroutine bSwitch_argl: not called CC=1 SCAR=6.9
Subroutine bSwitch_arglprepare: not called CC=1 SCAR=6.9
Subroutine bSwitch_args: not called CC=1 SCAR=6.9
Subroutine bSwitch_argt: not called CC=1 SCAR=6.9
Subroutine bSwitch_argv: not called CC=1 SCAR=6.9
Subroutine b_argc: not called CC=1 SCAR=6.9
Subroutine b_arge: not called CC=1 SCAR=6.9
Subroutine b_argh: not called CC=1 SCAR=6.9
Subroutine b_argl: not called CC=1 SCAR=6.9
Subroutine b_arglprepare: not called CC=1 SCAR=6.9
Subroutine b_args: not called CC=1 SCAR=6.9
Subroutine b_argt: not called CC=1 SCAR=6.9
Subroutine b_argv: not called CC=1 SCAR=6.9
Subroutine c: not called CC=1 SCAR=6.9
Subroutine cDefault: not called CC=1 SCAR=6.9
Subroutine cDefault_argc: not called CC=1 SCAR=6.9
Subroutine cDefault_arge: not called CC=1 SCAR=6.9
Subroutine cDefault_argh: not called CC=1 SCAR=6.9
Subroutine cDefault_argl: not called CC=1 SCAR=6.9
Subroutine cDefault_arglprepare: not called CC=1 SCAR=6.9
Subroutine cDefault_args: not called CC=1 SCAR=6.9
Subroutine cDefault_argt: not called CC=1 SCAR=6.9
Subroutine cDefault_argv: not called CC=1 SCAR=6.9
Subroutine cOption: not called CC=1 SCAR=6.9
Subroutine cOption_argc: not called CC=1 SCAR=6.9
Subroutine cOption_arge: not called CC=1 SCAR=6.9
Subroutine cOption_argh: not called CC=1 SCAR=6.9
Subroutine cOption_argl: not called CC=1 SCAR=6.9
Subroutine cOption_arglprepare: not called CC=1 SCAR=6.9
Subroutine cOption_args: not called CC=1 SCAR=6.9
Subroutine cOption_argt: not called CC=1 SCAR=6.9
Subroutine cOption_argv: not called CC=1 SCAR=6.9
Subroutine cRemoveOption: not called CC=1 SCAR=6.9
Subroutine cRemoveOption_argc: not called CC=1 SCAR=6.9
Subroutine cRemoveOption_arge: not called CC=1 SCAR=6.9
Subroutine cRemoveOption_argh: not called CC=1 SCAR=6.9
Subroutine cRemoveOption_argl: not called CC=1 SCAR=6.9
Subroutine cRemoveOption_arglprepare: not called CC=1 SCAR=6.9
Subroutine cRemoveOption_args: not called CC=1 SCAR=6.9
Subroutine cRemoveOption_argt: not called CC=1 SCAR=6.9
Subroutine cRemoveOption_argv: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch_argc: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch_arge: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch_argh: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch_argl: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch_arglprepare: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch_args: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch_argt: not called CC=1 SCAR=6.9
Subroutine cRemoveSwitch_argv: not called CC=1 SCAR=6.9
Subroutine cSwitch: not called CC=1 SCAR=6.9
Subroutine cSwitch_argc: not called CC=1 SCAR=6.9
Subroutine cSwitch_arge: not called CC=1 SCAR=6.9
Subroutine cSwitch_argh: not called CC=1 SCAR=6.9
Subroutine cSwitch_argl: not called CC=1 SCAR=6.9
Subroutine cSwitch_arglprepare: not called CC=1 SCAR=6.9
Subroutine cSwitch_args: not called CC=1 SCAR=6.9
Subroutine cSwitch_argt: not called CC=1 SCAR=6.9
Subroutine cSwitch_argv: not called CC=1 SCAR=6.9
Subroutine c_argc: not called CC=1 SCAR=6.9
Subroutine c_arge: not called CC=1 SCAR=6.9
Subroutine c_argh: not called CC=1 SCAR=6.9
Subroutine c_argl: not called CC=1 SCAR=6.9
Subroutine c_arglprepare: not called CC=1 SCAR=6.9
Subroutine c_args: not called CC=1 SCAR=6.9
Subroutine c_argt: not called CC=1 SCAR=6.9
Subroutine c_argv: not called CC=1 SCAR=6.9
Subroutine d: not called CC=1 SCAR=6.9
Subroutine dDefault: not called CC=1 SCAR=6.9
Subroutine dDefault_argc: not called CC=1 SCAR=6.9
Subroutine dDefault_arge: not called CC=1 SCAR=6.9
Subroutine dDefault_argh: not called CC=1 SCAR=6.9
Subroutine dDefault_argl: not called CC=1 SCAR=6.9
Subroutine dDefault_arglprepare: not called CC=1 SCAR=6.9
Subroutine dDefault_args: not called CC=1 SCAR=6.9
Subroutine dDefault_argt: not called CC=1 SCAR=6.9
Subroutine dDefault_argv: not called CC=1 SCAR=6.9
Subroutine dOption: not called CC=1 SCAR=6.9
Subroutine dOption_argc: not called CC=1 SCAR=6.9
Subroutine dOption_arge: not called CC=1 SCAR=6.9
Subroutine dOption_argh: not called CC=1 SCAR=6.9
Subroutine dOption_argl: not called CC=1 SCAR=6.9
Subroutine dOption_arglprepare: not called CC=1 SCAR=6.9
Subroutine dOption_args: not called CC=1 SCAR=6.9
Subroutine dOption_argt: not called CC=1 SCAR=6.9
Subroutine dOption_argv: not called CC=1 SCAR=6.9
Subroutine dRemoveOption: not called CC=1 SCAR=6.9
Subroutine dRemoveOption_argc: not called CC=1 SCAR=6.9
Subroutine dRemoveOption_arge: not called CC=1 SCAR=6.9
Subroutine dRemoveOption_argh: not called CC=1 SCAR=6.9
Subroutine dRemoveOption_argl: not called CC=1 SCAR=6.9
Subroutine dRemoveOption_arglprepare: not called CC=1 SCAR=6.9
Subroutine dRemoveOption_args: not called CC=1 SCAR=6.9
Subroutine dRemoveOption_argt: not called CC=1 SCAR=6.9
Subroutine dRemoveOption_argv: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch_argc: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch_arge: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch_argh: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch_argl: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch_arglprepare: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch_args: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch_argt: not called CC=1 SCAR=6.9
Subroutine dRemoveSwitch_argv: not called CC=1 SCAR=6.9
Subroutine dSwitch: not called CC=1 SCAR=6.9
Subroutine dSwitch_argc: not called CC=1 SCAR=6.9
Subroutine dSwitch_arge: not called CC=1 SCAR=6.9
Subroutine dSwitch_argh: not called CC=1 SCAR=6.9
Subroutine dSwitch_argl: not called CC=1 SCAR=6.9
Subroutine dSwitch_arglprepare: not called CC=1 SCAR=6.9
Subroutine dSwitch_args: not called CC=1 SCAR=6.9
Subroutine dSwitch_argt: not called CC=1 SCAR=6.9
Subroutine dSwitch_argv: not called CC=1 SCAR=6.9
Subroutine d_argc: not called CC=1 SCAR=6.9
Subroutine d_arge: not called CC=1 SCAR=6.9
Subroutine d_argh: not called CC=1 SCAR=6.9
Subroutine d_argl: not called CC=1 SCAR=6.9
Subroutine d_arglprepare: not called CC=1 SCAR=6.9
Subroutine d_args: not called CC=1 SCAR=6.9
Subroutine d_argt: not called CC=1 SCAR=6.9
Subroutine d_argv: not called CC=1 SCAR=6.9
Subroutine e: not called CC=1 SCAR=6.9
Subroutine e_argc: not called CC=1 SCAR=6.9
Subroutine e_arge: not called CC=1 SCAR=6.9
Subroutine e_argh: not called CC=1 SCAR=6.9
Subroutine e_argl: not called CC=1 SCAR=6.9
Subroutine e_arglprepare: not called CC=1 SCAR=6.9
Subroutine e_args: not called CC=1 SCAR=6.9
Subroutine e_argt: not called CC=1 SCAR=6.9
Subroutine e_argv: not called CC=1 SCAR=6.9
Subroutine f: not called CC=1 SCAR=6.9
Subroutine f_argc: not called CC=1 SCAR=6.9
Subroutine f_arge: not called CC=1 SCAR=6.9
Subroutine f_argh: not called CC=1 SCAR=6.9
Subroutine f_argl: not called CC=1 SCAR=6.9
Subroutine f_arglprepare: not called CC=1 SCAR=6.9
Subroutine f_args: not called CC=1 SCAR=6.9
Subroutine f_argt: not called CC=1 SCAR=6.9
Subroutine f_argv: not called CC=1 SCAR=6.9
Subroutine g: not called CC=1 SCAR=6.9
Subroutine g_argc: not called CC=1 SCAR=6.9
Subroutine g_arge: not called CC=1 SCAR=6.9
Subroutine g_argh: not called CC=1 SCAR=6.9
Subroutine g_argl: not called CC=1 SCAR=6.9
Subroutine g_arglprepare: not called CC=1 SCAR=6.9
Subroutine g_args: not called CC=1 SCAR=6.9
Subroutine g_argt: not called CC=1 SCAR=6.9
Subroutine g_argv: not called CC=1 SCAR=6.9
Subroutine h: not called CC=1 SCAR=6.9
Subroutine h_argc: not called CC=1 SCAR=6.9
Subroutine h_arge: not called CC=1 SCAR=6.9
Subroutine h_argh: not called CC=1 SCAR=6.9
Subroutine h_argl: not called CC=1 SCAR=6.9
Subroutine h_arglprepare: not called CC=1 SCAR=6.9
Subroutine h_args: not called CC=1 SCAR=6.9
Subroutine h_argt: not called CC=1 SCAR=6.9
Subroutine h_argv: not called CC=1 SCAR=6.9
Subroutine i: not called CC=1 SCAR=6.9
Subroutine i_argc: not called CC=1 SCAR=6.9
Subroutine i_arge: not called CC=1 SCAR=6.9
Subroutine i_argh: not called CC=1 SCAR=6.9
Subroutine i_argl: not called CC=1 SCAR=6.9
Subroutine i_arglprepare: not called CC=1 SCAR=6.9
Subroutine i_args: not called CC=1 SCAR=6.9
Subroutine i_argt: not called CC=1 SCAR=6.9
Subroutine i_argv: not called CC=1 SCAR=6.9
Subroutine j: not called CC=1 SCAR=6.9
Subroutine j_argc: not called CC=1 SCAR=6.9
Subroutine j_arge: not called CC=1 SCAR=6.9
Subroutine j_argh: not called CC=1 SCAR=6.9
Subroutine j_argl: not called CC=1 SCAR=6.9
Subroutine j_arglprepare: not called CC=1 SCAR=6.9
Subroutine j_args: not called CC=1 SCAR=6.9
Subroutine j_argt: not called CC=1 SCAR=6.9
Subroutine j_argv: not called CC=1 SCAR=6.9
Subroutine k: not called CC=1 SCAR=6.9
Subroutine k_argc: not called CC=1 SCAR=6.9
Subroutine k_arge: not called CC=1 SCAR=6.9
Subroutine k_argh: not called CC=1 SCAR=6.9
Subroutine k_argl: not called CC=1 SCAR=6.9
Subroutine k_arglprepare: not called CC=1 SCAR=6.9
Subroutine k_args: not called CC=1 SCAR=6.9
Subroutine k_argt: not called CC=1 SCAR=6.9
Subroutine k_argv: not called CC=1 SCAR=6.9
Subroutine l: not called CC=1 SCAR=6.9
Subroutine l_argc: not called CC=1 SCAR=6.9
Subroutine l_arge: not called CC=1 SCAR=6.9
Subroutine l_argh: not called CC=1 SCAR=6.9
Subroutine l_argl: not called CC=1 SCAR=6.9
Subroutine l_arglprepare: not called CC=1 SCAR=6.9
Subroutine l_args: not called CC=1 SCAR=6.9
Subroutine l_argt: not called CC=1 SCAR=6.9
Subroutine l_argv: not called CC=1 SCAR=6.9
Subroutine m: not called CC=1 SCAR=6.9
Subroutine m_argc: not called CC=1 SCAR=6.9
Subroutine m_arge: not called CC=1 SCAR=6.9
Subroutine m_argh: not called CC=1 SCAR=6.9
Subroutine m_argl: not called CC=1 SCAR=6.9
Subroutine m_arglprepare: not called CC=1 SCAR=6.9
Subroutine m_args: not called CC=1 SCAR=6.9
Subroutine m_argt: not called CC=1 SCAR=6.9
Subroutine m_argv: not called CC=1 SCAR=6.9
Subroutine multiparam01: not called CC=1 SCAR=6.9
Subroutine multiparam01_argc: not called CC=1 SCAR=6.9
Subroutine multiparam01_arge: not called CC=1 SCAR=6.9
Subroutine multiparam01_argh: not called CC=1 SCAR=6.9
Subroutine multiparam01_argl: not called CC=1 SCAR=6.9
Subroutine multiparam01_arglprepare: not called CC=1 SCAR=6.9
Subroutine multiparam01_args: not called CC=1 SCAR=6.9
Subroutine multiparam01_argt: not called CC=1 SCAR=6.9
Subroutine multiparam01_argv: not called CC=1 SCAR=6.9
Subroutine multiparam02: not called CC=1 SCAR=6.9
Subroutine multiparam02_argc: not called CC=1 SCAR=6.9
Subroutine multiparam02_arge: not called CC=1 SCAR=6.9
Subroutine multiparam02_argh: not called CC=1 SCAR=6.9
Subroutine multiparam02_argl: not called CC=1 SCAR=6.9
Subroutine multiparam02_arglprepare: not called CC=1 SCAR=6.9
Subroutine multiparam02_args: not called CC=1 SCAR=6.9
Subroutine multiparam02_argt: not called CC=1 SCAR=6.9
Subroutine multiparam02_argv: not called CC=1 SCAR=6.9
Subroutine multiparam03: not called CC=1 SCAR=6.9
Subroutine multiparam03_argc: not called CC=1 SCAR=6.9
Subroutine multiparam03_arge: not called CC=1 SCAR=6.9
Subroutine multiparam03_argh: not called CC=1 SCAR=6.9
Subroutine multiparam03_argl: not called CC=1 SCAR=6.9
Subroutine multiparam03_arglprepare: not called CC=1 SCAR=6.9
Subroutine multiparam03_args: not called CC=1 SCAR=6.9
Subroutine multiparam03_argt: not called CC=1 SCAR=6.9
Subroutine multiparam03_argv: not called CC=1 SCAR=6.9
Subroutine n: not called CC=1 SCAR=6.9
Subroutine n_argc: not called CC=1 SCAR=6.9
Subroutine n_arge: not called CC=1 SCAR=6.9
Subroutine n_argh: not called CC=1 SCAR=6.9
Subroutine n_argl: not called CC=1 SCAR=6.9
Subroutine n_arglprepare: not called CC=1 SCAR=6.9
Subroutine n_args: not called CC=1 SCAR=6.9
Subroutine n_argt: not called CC=1 SCAR=6.9
Subroutine n_argv: not called CC=1 SCAR=6.9
Subroutine numOpt: not called CC=1 SCAR=6.9
Subroutine numOpt_argc: not called CC=1 SCAR=6.9
Subroutine numOpt_arge: not called CC=1 SCAR=6.9
Subroutine numOpt_argh: not called CC=1 SCAR=6.9
Subroutine numOpt_argl: not called CC=1 SCAR=6.9
Subroutine numOpt_arglprepare: not called CC=1 SCAR=6.9
Subroutine numOpt_args: not called CC=1 SCAR=6.9
Subroutine numOpt_argt: not called CC=1 SCAR=6.9
Subroutine numOpt_argv: not called CC=1 SCAR=6.9
Subroutine o: not called CC=1 SCAR=6.9
Subroutine o_argc: not called CC=1 SCAR=6.9
Subroutine o_arge: not called CC=1 SCAR=6.9
Subroutine o_argh: not called CC=1 SCAR=6.9
Subroutine o_argl: not called CC=1 SCAR=6.9
Subroutine o_arglprepare: not called CC=1 SCAR=6.9
Subroutine o_args: not called CC=1 SCAR=6.9
Subroutine o_argt: not called CC=1 SCAR=6.9
Subroutine o_argv: not called CC=1 SCAR=6.9
Subroutine p: not called CC=1 SCAR=6.9
Subroutine p_argc: not called CC=1 SCAR=6.9
Subroutine p_arge: not called CC=1 SCAR=6.9
Subroutine p_argh: not called CC=1 SCAR=6.9
Subroutine p_argl: not called CC=1 SCAR=6.9
Subroutine p_arglprepare: not called CC=1 SCAR=6.9
Subroutine p_args: not called CC=1 SCAR=6.9
Subroutine p_argt: not called CC=1 SCAR=6.9
Subroutine p_argv: not called CC=1 SCAR=6.9
Subroutine param01: not called CC=1 SCAR=6.9
Subroutine param01_argc: not called CC=1 SCAR=6.9
Subroutine param01_arge: not called CC=1 SCAR=6.9
Subroutine param01_argh: not called CC=1 SCAR=6.9
Subroutine param01_argl: not called CC=1 SCAR=6.9
Subroutine param01_arglprepare: not called CC=1 SCAR=6.9
Subroutine param01_args: not called CC=1 SCAR=6.9
Subroutine param01_argt: not called CC=1 SCAR=6.9
Subroutine param01_argv: not called CC=1 SCAR=6.9
Subroutine param02: not called CC=1 SCAR=6.9
Subroutine param02_argc: not called CC=1 SCAR=6.9
Subroutine param02_arge: not called CC=1 SCAR=6.9
Subroutine param02_argh: not called CC=1 SCAR=6.9
Subroutine param02_argl: not called CC=1 SCAR=6.9
Subroutine param02_arglprepare: not called CC=1 SCAR=6.9
Subroutine param02_args: not called CC=1 SCAR=6.9
Subroutine param02_argt: not called CC=1 SCAR=6.9
Subroutine param02_argv: not called CC=1 SCAR=6.9
Subroutine param03: not called CC=1 SCAR=6.9
Subroutine param03_argc: not called CC=1 SCAR=6.9
Subroutine param03_arge: not called CC=1 SCAR=6.9
Subroutine param03_argh: not called CC=1 SCAR=6.9
Subroutine param03_argl: not called CC=1 SCAR=6.9
Subroutine param03_arglprepare: not called CC=1 SCAR=6.9
Subroutine param03_args: not called CC=1 SCAR=6.9
Subroutine param03_argt: not called CC=1 SCAR=6.9
Subroutine param03_argv: not called CC=1 SCAR=6.9
Subroutine param04: not called CC=1 SCAR=6.9
Subroutine param04_argc: not called CC=1 SCAR=6.9
Subroutine param04_arge: not called CC=1 SCAR=6.9
Subroutine param04_argh: not called CC=1 SCAR=6.9
Subroutine param04_argl: not called CC=1 SCAR=6.9
Subroutine param04_arglprepare: not called CC=1 SCAR=6.9
Subroutine param04_args: not called CC=1 SCAR=6.9
Subroutine param04_argt: not called CC=1 SCAR=6.9
Subroutine param04_argv: not called CC=1 SCAR=6.9
Subroutine param06: not called CC=1 SCAR=6.9
Subroutine param06_argc: not called CC=1 SCAR=6.9
Subroutine param06_arge: not called CC=1 SCAR=6.9
Subroutine param06_argh: not called CC=1 SCAR=6.9
Subroutine param06_argl: not called CC=1 SCAR=6.9
Subroutine param06_arglprepare: not called CC=1 SCAR=6.9
Subroutine param06_args: not called CC=1 SCAR=6.9
Subroutine param06_argt: not called CC=1 SCAR=6.9
Subroutine param06_argv: not called CC=1 SCAR=6.9
Subroutine switch01: not called CC=1 SCAR=6.9
Subroutine switch01_argc: not called CC=1 SCAR=6.9
Subroutine switch01_arge: not called CC=1 SCAR=6.9
Subroutine switch01_argh: not called CC=1 SCAR=6.9
Subroutine switch01_argl: not called CC=1 SCAR=6.9
Subroutine switch01_arglprepare: not called CC=1 SCAR=6.9
Subroutine switch01_args: not called CC=1 SCAR=6.9
Subroutine switch01_argt: not called CC=1 SCAR=6.9
Subroutine switch01_argv: not called CC=1 SCAR=6.9
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod documented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
Pod undocumented
892 }
893 }
894  
895 #### Method: alias
896 #######################################################################
897 #Routine to associate an alias of set of aliases w/ a parameter
898 #######################################################################
899 0 ▶sub _a { &_alias(@_); }
Subroutine _a: not called CC=1 SCAR=6.9
900 3 ▶sub _alias {
Subroutine _alias: called CC=5 SCAR=16.2
901 3 my($self) = shift;
902 3 my($parameter) = shift;
903 3 my(%a) = map { $_, 1 } @_;
904 3 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 3 0 3
905 3 foreach my $a ( @_ ) {
906 croak "Alias '$a' specified for '$parameter' is already defined for '$self->{'aliasnamehash'}->{$a}'.\n"
907 3 ▶ if (exists $self->{'aliasnamehash'}->{$a});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"aliasnamehash"}{$a} 0 3 3
908 }
909 }
910 3 foreach my $a ( @_ ) {
911 3 $self->{'parameter'}->{$parameter}->{'alias'}->{$a} = 1;
912 3 $self->{'aliasnamehash'}->{$a} = $parameter;
913 }
914 }
915  
916 #### Method: keys
917 #######################################################################
918 #Routine to associate user-specified values w/ specified parameters
919 # keys( param, 0, 1, 2, 3 )
920 # keys( param, [ 0, 1, 2, 3 ] )
921 # keys( multiparam, [ 0, 1, 2 ], [ 4, 5, 6 ], [ 7, 8, 9 ] )
922 # keys( multiparam, { 'sub1' => [ 0, 1, 2 ], 'sub2' => [ 4, 5, 6 ], 'sub3' => [ 7, 8, 9 ] } )
923 #######################################################################
924 0 ▶sub _key { &_keys(@_); }
Subroutine _key: not called CC=1 SCAR=6.9
925 0 ▶sub _k { &_keys(@_); }
Subroutine _k: not called CC=1 SCAR=6.9
926 2 ▶sub _keys {
Subroutine _keys: called CC=10 SCAR=25.0
927 2 my($self) = shift;
928 2 my($parameter) = shift;
929 2 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 2 2
930 2 ▶ if (@{$self->{$pKind}->{$parameter}->{'type'}} > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->{$pKind}{$parameter}{'type'};} > 1) { } 1 1 2
931 1 ▶ if (@_ > 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_ > 1) { } 0 1 1
elsif (ref $_[0] eq 'HASH') { } 1 0 1
932 0 $self->{$pKind}->{$parameter}->{'keys'} = \@_;
933 } elsif (ref($_[0]) eq 'HASH') {
934 1 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 1 0 1
935 1 foreach ( keys %{$_[0]} ) {
936 croak "Subparameter $_ does not exist for $parameter"
937 2 ▶ unless (exists $self->{$pKind}->{$parameter}->{'nameOrder'}->{$_});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{$pKind}{$parameter}{"nameOrder"}{$_} 0 2 2
938 }
939 }
940 1 foreach ( keys %{$_[0]} ) {
941 2 $self->{$pKind}->{$parameter}->{'keys'}->[$self->{$pKind}->{$parameter}->{'nameOrder'}->{$_}] = $_[0]->{$_};
942 }
943 } else {
944 0 croak "Format of argument for _keys call is not valid.";
945 }
946 } else {
947 1 ▶ if (ref($_[0]) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'ARRAY') { } 0 1 1
948 0 $self->{$pKind}->{$parameter}->{'keys'} = [ $_[0] ];
949 } else {
950 1 $self->{$pKind}->{$parameter}->{'keys'} = [ \@_ ];
951 }
952 }
953 }
954  
955 #### Method: unique
956 #######################################################################
957 #Routine to mark parameters as unique
958 #######################################################################
959 0 ▶sub _u { &_unique(@_); }
Subroutine _u: not called CC=1 SCAR=6.9
960 2 ▶sub _unique {
Subroutine _unique: called CC=3 SCAR=11.1
961 2 my($self) = shift;
962 2 foreach my $p ( @_ ) {
963 2 ▶ my($pKind) = (exists $self->{'special'}->{$p})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$p} ? : 0 2 2
964 2 $self->{$pKind}->{$p}->{'unique'} = 1;
965 }
966 }
967  
968 #### Method: default
969 #######################################################################
970 #Routine to associate default values w/ specified parameters
971 # For p: $opt->d('p', 0, 1, 2, 3);
972 # For mp: $opt->d('p', [0, 1], [2, 3]);
973 #######################################################################
974 0 ▶sub _d { &_default(@_); }
Subroutine _d: not called CC=1 SCAR=6.9
975 1 ▶sub _default {
Subroutine _default: called CC=4 SCAR=14.2
976 1 my($self) = shift;
977 1 my($parameter) = shift;
978 1 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 1 1
979 #Quick check for switch or switch-like type
980 croak "Default assignment of type '$self->{$pKind}->{$parameter}->{'type'}->[0]' makes no sense"
981 1 ▶ if ($self->{'types'}->{$self->{$pKind}->{$parameter}->{'type'}->[0]}->{'number_of_arguments'} == 0);
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"types"}{$self->{$pKind}{$parameter}{"type"}[0]}{"number_of_arguments"} == 0 0 1 1
982 #Store default values
983 1 @{$self->{$pKind}->{$parameter}->{'default'}} = map { [ $_ ] } @_;
984 #Bulletproofing....do later (check default values for type matching, etc.
985 1 ▶ if ($self->{'prefs'}->{'development_check'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"prefs"}{"development_check"}) 1 0 1
986 }
987 }
988  
989 #### Method: description
990 #######################################################################
991 #Routine to store a description of the script
992 #######################################################################
993 0 ▶sub _description {
Subroutine _description: not called CC=1 SCAR=0.6
994 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
995 0 my($self) = shift;
996 0 $self->{'description'} = shift;
997 }
998  
999 #### Method: pattern
1000 #######################################################################
1001 #Routine to specify pattern(s) for a particular argument
1002 #######################################################################
1003 0 ▶sub _pattern {
Subroutine _pattern: not called CC=4 SCAR=30.0
1004 0 my($self) = shift;
1005 0 my($parameter) = shift;
1006 0 ▶ my($pKind) = (exists $self->{'special'}->{$parameter})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$parameter} ? : 0 0 0
1007 0 my($i) = 0;
1008 0 ▶ if (exists $self->{$pKind}->{$parameter}->{'nameOrder'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{$pKind}{$parameter}{"nameOrder"}) 0 0 0
1009 0 my($name) = shift;
1010 croak "Subparameter ($name) not found for '$parameter'"
1011 0 ▶ unless (exists $self->{$pKind}->{$parameter}->{'nameOrder'}->{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{$pKind}{$parameter}{"nameOrder"}{$name} 0 0 0
1012 0 $i = $self->{$pKind}->{$parameter}->{'nameOrder'}->{$name};
1013 }
1014 0 push(@{$self->{$pKind}->{$parameter}->{'pattern'}->[$i]}, @_); }
1015  
1016 #### Method: help
1017 #######################################################################
1018 #Routine to specify the help string of a parameter
1019 #######################################################################
1020 6 ▶sub _h { &_help(@_); }
Subroutine _h: called CC=1 SCAR=0.0
1021 48 ▶sub _help {
Subroutine _help: called CC=4 SCAR=13.9
1022 1 ▶ use strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1023 48 my($self) = shift;
1024 #If only one argument, take as description string for entire script, not for a specific parameter
1025 48 ▶ if (@_ == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_ == 1) { } 1 47 48
elsif (@_ == 2) { } 47 0 47
1026 1 $self->{'description'} = $_[0];
1027 1 chomp($self->{'description'});
1028 } elsif (@_ == 2) {
1029 47 ▶ my($pKind) = (exists $self->{'special'}->{$_[0]})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$_[0]} ? : 21 26 47
1030 47 $self->{$pKind}->{$_[0]}->{'help'} = $_[1];
1031 47 chomp($self->{$pKind}->{$_[0]}->{'help'});
1032 } else {
1033 0 croak "Incorrect number of arguments to 'help' method.";
1034 }
1035 }
1036  
1037 #### Method: help_option
1038 #######################################################################
1039 #Routine to specify the help option for special parameters
1040 #######################################################################
1041 0 ▶sub _h_opt { &_help_option(@_); }
Subroutine _h_opt: not called CC=1 SCAR=6.9
1042 21 ▶sub _help_option {
Subroutine _help_option: called CC=2 SCAR=7.6
1043 21 my($self) = shift;
1044 21 ▶ if (@_ == 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 2) { } 21 0 21
1045 21 $self->{'special'}->{$_[0]}->{'help_option'} = $_[1];
1046 } else {
1047 0 croak "Incorrect number of arguments to 'help_option' method.";
1048 }
1049 }
1050  
1051 #### Method: required
1052 #######################################################################
1053 #Routine to specify that certain parameters are required
1054 #######################################################################
1055 0 ▶sub _r { &_required(@_); }
Subroutine _r: not called CC=1 SCAR=6.9
1056 1 ▶sub _required {
Subroutine _required: called CC=3 SCAR=11.1
1057 1 my($self) = shift;
1058 1 foreach my $p ( @_ ) {
1059 1 ▶ my($pKind) = (exists $self->{'special'}->{$p})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$p} ? : 0 1 1
1060 1 $self->{$pKind}->{$p}->{'required'} = 1;
1061 }
1062 }
1063  
1064 #### Method: mutex
1065 #######################################################################
1066 #Routine to define sets of mutually exclusive parameters.
1067 # This checking takes place after argument parsing and prior to default
1068 # bindings.
1069 #######################################################################
1070 0 ▶sub _mutually_exclusive { &_mutex(@_); }
Subroutine _mutually_exclusive: not called CC=1 SCAR=6.9
1071 1 ▶sub _mutex {
Subroutine _mutex: called CC=1 SCAR=0.0
1072 1 my($self) = shift;
1073 1 push(@{$self->{'checks'}->{'mutex'}}, \@_);
1074 }
1075  
1076 #### Method: req_grp
1077 #######################################################################
1078 #Routine to define sets of options such that if any option in a group
1079 # is used, all others in that group must also be used.
1080 #######################################################################
1081 0 ▶sub _rg { &_req_grp(@_); }
Subroutine _rg: not called CC=1 SCAR=6.9
1082 0 ▶sub _group { &_req_grp(@_); }
Subroutine _group: not called CC=1 SCAR=6.9
1083 0 ▶sub _required_group { &_req_grp(@_); }
Subroutine _required_group: not called CC=1 SCAR=6.9
1084 1 ▶sub _req_grp {
Subroutine _req_grp: called CC=1 SCAR=0.0
1085 1 my($self) = shift;
1086 1 push(@{$self->{'checks'}->{'req_grp'}}, \@_);
1087 }
1088  
1089 #### Method: argumentFileComment
1090 #######################################################################
1091 #Routine to add a string for designating comment lines in an
1092 # arguementFile.
1093 #######################################################################
1094 0 ▶sub _argumentFileComment { &_argument_file_comment(@_); }
Subroutine _argumentFileComment: not called CC=1 SCAR=6.9
1095 0 ▶sub _argument_file_comment {
Subroutine _argument_file_comment: not called CC=3 SCAR=24.8
1096 0 my($self) = shift;
1097 0 my($p) = shift;
1098 0 ▶ my($pKind) = (exists $self->{'special'}->{$p})? 'special' : 'parameter';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$p} ? : 0 0 0
1099 0 foreach my $c ( @_ ) {
1100 0 push(@{$self->{$pKind}->{$p}->{'argumentFileComment'}}, $c);
1101 }
1102 }
1103  
1104 #### Method: _assert_predefined_types
1105 #######################################################################
1106 #Routine to assert predefined types:
1107 # Define the number of arguments.
1108 # Each argument gets an entry in the 'arguments' array defining all
1109 # the argument attributes: range, pattern, translation, etc.
1110 ##NOTE: I added '. "\$"' on the end of some of these strings to make
1111 # my emacs highlighting mode happy since it always thinks that $' is a
1112 # perl variable (even at the end of a single-quoted string, and I'm not
1113 # much of a lisp hacker).
1114 #######################################################################
1115 1 ▶sub __assert_predefined_types {
Subroutine __assert_predefined_types: called CC=1 SCAR=0.0
1116 1 my($self) = @_;
1117  
1118 #Switch
1119 1 $self->{'types'}->{'switch'} =
1120 { 'number_of_arguments' => 0,
1121 #Special keys for types w/ zero arguments
1122 'specifiedvalue' => 1,
1123 'unspecifiedvalue' => 0,
1124 };
1125  
1126 #Integer
1127 1 $self->{'types'}->{'integer'} =
1128 { 'number_of_arguments' => 1,
1129 'arguments' => [
1130 { 'range' => [],
1131 'pattern' => [ '^[+-]?\d+' . "\$", ],
1132 'translation' => {},
1133 'range_translation' => {},
1134 'pattern_translation' => {},
1135 },
1136 ],
1137 };
1138  
1139 #Natural
1140 1 $self->{'types'}->{'natural'} =
1141 { 'number_of_arguments' => 1,
1142 'arguments' => [
1143 { 'range' => [],
1144 'pattern' => [ '^\+?\d+' . "\$", ],
1145 'translation' => {},
1146 'range_translation' => {},
1147 'pattern_translation' => {},
1148 },
1149 ],
1150 };
1151  
1152 #Real
1153 1 $self->{'types'}->{'real'} =
1154 { 'number_of_arguments' => 1,
1155 'arguments' => [
1156 { 'range' => [],
1157 'pattern' => [ '^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?' . "\$", ],
1158 'translation' => {},
1159 'range_translation' => {},
1160 'pattern_translation' => {},
1161 },
1162 ],
1163 };
1164  
1165 #File
1166 1 $self->{'types'}->{'file'} =
1167 { 'number_of_arguments' => 1,
1168 'arguments' => [
1169 { 'range' => [],
1170 'pattern' => [],
1171 'translation' => {},
1172 'range_translation' => {},
1173 'pattern_translation' => {},
1174 },
1175 ],
1176 };
1177  
1178 #String
1179 1 $self->{'types'}->{'string'} =
1180 { 'number_of_arguments' => 1,
1181 'arguments' => [
1182 { 'range' => [],
1183 'pattern' => [],
1184 'translation' => {},
1185 'range_translation' => {},
1186 'pattern_translation' => {},
1187 },
1188 ],
1189 };
1190  
1191 #######################################################################
1192 #ArgumentFile: a file containing more command line arguments to parse
1193 #######################################################################
1194 1 $self->{'types'}->{'argumentFile'} =
1195 { 'number_of_arguments' => 1,
1196 'arguments' => [
1197 { 'range' => [],
1198 'pattern' => [],
1199 'translation' => {},
1200 'range_translation' => {},
1201 'pattern_translation' => {},
1202 },
1203 ],
1204 };
1205  
1206 }
1207  
1208 #### Method: _parse_prefs
1209 #######################################################################
1210 #Routine to parse prefs hash
1211 #######################################################################
1212 1 ▶sub __parse_prefs {
Subroutine __parse_prefs: called CC=5 SCAR=18.6
1213 1 my($self, $prefs) = @_;
1214 #Overwrite elements in $self as specified by $prefs hash
1215 1 foreach my $prefKey (keys %{$prefs}) {
1216 3 ▶ croak "Unknown preference '$prefKey' specified" unless (exists $self->{'prefs'}->{$prefKey});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"prefs"}{$prefKey} 0 3 3
1217 3 ▶ if (ref($self->{'prefs'}->{$prefKey}) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'prefs'}{$prefKey} eq 'HASH') { } 0 3 3
1218 0 foreach my $key ( @{$prefs->{$prefKey}} ) {
1219 0 $self->{'prefs'}->{$prefKey}->{$key} = 1;
1220 }
1221 } else {
1222 3 $self->{'prefs'}->{$prefKey} = $prefs->{$prefKey};
1223 }
1224 }
1225 }
1226  
1227 #########################################################################
1228 #Auxiliary routine to return number of arguments for specified parameter
1229 # according to type definition.
1230 #########################################################################
1231 0 ▶sub __number_of_arguments {
Subroutine __number_of_arguments: not called CC=1 SCAR=6.9
1232 0 my($self) = @_;
1233 }
1234  
1235 #######################################################################
1236 #Auxiliary routine to print out help text
1237 #######################################################################
1238 0 ▶sub __print_help {
Subroutine __print_help: not called CC=29 SCAR=67.7
1239 0 my($self, $argv, $lvl) = @_;
1240 0 ▶ $lvl = 0 unless (defined $lvl);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $lvl 0 0 0
1241 #Build up a help string:
1242 0 ▶ print "\nDESCRIPTION:\n", $self->{'description'}, "\n" if (exists $self->{'description'});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"description"} 0 0 0
1243 #$0 <required options> [optional options]
1244 0 my($help) = [ "\nUSAGE:\n$0", ];
1245 0 ▶ foreach my $opt ( grep { (exists $self->{'parameter'}->{$_}->{'required'}) and ($self->{'parameter'}->{$_}->{'required'} == 1) }
Condition0%0/3
exists $self->{'parameter'}{$_}{'required'} && $self->{'parameter'}{$_}{'required'} == 1
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{'parameter'}{$_}{'required'} && $self->{'parameter'}{$_}{'required'} == 1
exists $self->{'parameter'}{$_}{'required'} $self->{'parameter'}{$_}{'required'} == 1
Truth table0%0/3
A && B
A= exists $self->{'parameter'}{$_}{'required'}B= $self->{'parameter'}{$_}{'required'} == 1
ABresult
0X0
100
111
1246 0 sort keys %{$self->{'parameter'}} ) {
1247 0 push(@{$help}, "-$opt");
1248 0 push(@{$help}, join(' ', map { "<$_>" } @{$self->{'parameter'}->{$opt}->{'type'}}))
1249 0 ▶ unless ($self->{'types'}->{$self->{'parameter'}->{$opt}->{'type'}->[0]}->{'number_of_arguments'} == 0);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"types"}{$self->{"parameter"}{$opt}{"type"}[0]}{"number_of_arguments"} == 0 0 0 0
1250 }
1251 0 ▶ foreach my $opt ( grep { (exists $self->{'special'}->{$_}->{'required'}) and ($self->{'special'}->{$_}->{'required'} == 1) }
Condition0%0/3
exists $self->{'special'}{$_}{'required'} && $self->{'special'}{$_}{'required'} == 1
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{'special'}{$_}{'required'} && $self->{'special'}{$_}{'required'} == 1
exists $self->{'special'}{$_}{'required'} $self->{'special'}{$_}{'required'} == 1
Truth table0%0/3
A && B
A= exists $self->{'special'}{$_}{'required'}B= $self->{'special'}{$_}{'required'} == 1
ABresult
0X0
100
111
1252 0 sort keys %{$self->{'special'}} ) {
1253 0 ▶ push(@{$help}, (exists $self->{'special'}->{$_}->{'help_option'})? $self->{'special'}->{$_}->{'help_option'} : $self->{'special'}->{$_}->{'pattern'});
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$_}{'help_option'} ? : 0 0 0
1254 }
1255 0 ▶ foreach my $opt ( grep { (not exists $self->{'parameter'}->{$_}->{'required'}) or ($self->{'parameter'}->{$_}->{'required'} == 0) }
Condition0%0/3
!exists $self->{'parameter'}{$_}{'required'} || $self->{'parameter'}{$_}{'required'} == 0
l!l&&r!l&&!r
000
MC/DC0%0/2
!exists $self->{'parameter'}{$_}{'required'} || $self->{'parameter'}{$_}{'required'} == 0
!exists $self->{'parameter'}{$_}{'required'} $self->{'parameter'}{$_}{'required'} == 0
Truth table0%0/3
not(A) || B
A= !exists $self->{'parameter'}{$_}{'required'}B= $self->{'parameter'}{$_}{'required'} == 0
ABresult
1X1
011
000
1256 0 sort keys %{$self->{'parameter'}} ) {
1257 0 push(@{$help}, "[-$opt");
1258 0 push(@{$help}, join(' ', map { "<$_>" } @{$self->{'parameter'}->{$opt}->{'type'}}))
1259 0 ▶ unless ($self->{'types'}->{$self->{'parameter'}->{$opt}->{'type'}->[0]}->{'number_of_arguments'} == 0);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"types"}{$self->{"parameter"}{$opt}{"type"}[0]}{"number_of_arguments"} == 0 0 0 0
1260 0 $help->[$#{$help}] .= "]";
1261 }
1262 0 ▶ foreach my $opt ( grep { (not exists $self->{'special'}->{$_}->{'required'}) or ($self->{'special'}->{$_}->{'required'} == 0) }
Condition0%0/3
!exists $self->{'special'}{$_}{'required'} || $self->{'special'}{$_}{'required'} == 0
l!l&&r!l&&!r
000
MC/DC0%0/2
!exists $self->{'special'}{$_}{'required'} || $self->{'special'}{$_}{'required'} == 0
!exists $self->{'special'}{$_}{'required'} $self->{'special'}{$_}{'required'} == 0
Truth table0%0/3
not(A) || B
A= !exists $self->{'special'}{$_}{'required'}B= $self->{'special'}{$_}{'required'} == 0
ABresult
1X1
011
000
1263 0 sort keys %{$self->{'special'}} ) {
1264 0 ▶ push(@{$help}, '[' . ((exists $self->{'special'}->{$opt}->{'help_option'})? $self->{'special'}->{$opt}->{'help_option'} : $self->{'special'}->{$opt}->{'special_pattern'}));
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$opt}{'help_option'} ? : 0 0 0
1265 0 push(@{$help}, join(' ', map { "<$_>" } @{$self->{'special'}->{$opt}->{'type'}}))
1266 0 ▶ unless ($self->{'types'}->{$self->{'special'}->{$opt}->{'type'}->[0]}->{'number_of_arguments'} == 0);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"types"}{$self->{"special"}{$opt}{"type"}[0]}{"number_of_arguments"} == 0 0 0 0
1267 0 $help->[$#{$help}] .= ']';
1268 }
1269 0 print join(' ', @{$help}), "\n\n";
1270 #Print extended help messages if full_help
1271 0 ▶ if ($lvl > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lvl > 1) 0 0 0
1272 0 $help = {};
1273 0 foreach my $opt ( sort keys %{$self->{'parameter'}} ) {
1274 0 my($key) = "-$opt";
1275 0 $key .= join(' ', '', map { "<$_>" } @{$self->{'parameter'}->{$opt}->{'type'}})
1276 0 ▶ unless ($self->{'types'}->{$self->{'parameter'}->{$opt}->{'type'}->[0]}->{'number_of_arguments'} == 0);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"types"}{$self->{"parameter"}{$opt}{"type"}[0]}{"number_of_arguments"} == 0 0 0 0
1277 0 ▶ $help->{$key} = (exists $self->{'parameter'}->{$opt}->{'help'})? $self->{'parameter'}->{$opt}->{'help'} : '__no help text__';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'parameter'}{$opt}{'help'} ? : 0 0 0
1278 }
1279 0 foreach my $opt ( sort keys %{$self->{'special'}} ) {
1280 0 ▶ my($key) = (exists $self->{'special'}->{$opt}->{'help_option'})? $self->{'special'}->{$opt}->{'help_option'} : $self->{'special'}->{$opt}->{'special_pattern'};
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$opt}{'help_option'} ? : 0 0 0
1281 0 $key .= join(' ', '', map { "<$_>" } @{$self->{'special'}->{$opt}->{'type'}})
1282 0 ▶ unless ($self->{'types'}->{$self->{'special'}->{$opt}->{'type'}->[0]}->{'number_of_arguments'} == 0);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"types"}{$self->{"special"}{$opt}{"type"}[0]}{"number_of_arguments"} == 0 0 0 0
1283 0 ▶ $help->{$key} = (exists $self->{'special'}->{$opt}->{'help'})? $self->{'special'}->{$opt}->{'help'} : '__no help text__';
Branch: 1 branch
BranchTrueFalseTotal
exists $self->{'special'}{$opt}{'help'} ? : 0 0 0
1284 }
1285 #Get longest key length of $help
1286 0 my($len) = (reverse sort {$a<=>$b;} map { length($_) } keys %{$help})[0];
1287 0 print "FULL HELP LISTING:\n";
1288 0 foreach ( sort keys %{$help} ) {
1289 0 print " ", $_, (' ' x ($len-length($_)+2)), $help->{$_}, "\n";
1290 }
1291 0 print "\n";
1292  
1293 0 ▶ if (exists $self->{'checks'}->{'req_grp'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"checks"}{"req_grp"}) 0 0 0
1294 0 foreach my $req_grp ( @{$self->{'checks'}->{'req_grp'}} ) {
1295 0 print "These options must be specified together: ", join(', ', @{$req_grp}), ".\n";
1296 }
1297 0 print "\n";
1298 }
1299 0 ▶ if (exists $self->{'checks'}->{'mutex'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{"checks"}{"mutex"}) 0 0 0
1300 0 foreach my $mutex ( @{$self->{'checks'}->{'mutex'}} ) {
1301 0 print "These options are mutually exclusive: ", join(', ', @{$mutex}), ".\n";
1302 }
1303 0 print "\n";
1304 }
1305 }
1306  
1307 0 exit;
1308 }
1309  
1310 1 1;
1311  
1312 __END__
↑ Summary Getopt/t/1.t »