- Timestamp:
- 2000-07-13T10:21:53+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New_Config_Format-branch/gsdl/perllib/parsargv.pm
r537 r1279 64 64 # Returns 0 if there was an error, nonzero otherwise. 65 65 # 66 sub parse 66 67 68 sub parse 67 69 { 68 70 my $arglist = shift; … … 70 72 my %option; 71 73 72 while (($spec, $var) = splice(@_, 0, 2)) 73 { 74 my @rest = @_; 75 76 # if the last argument is the string "allow_extra_options" then options 77 # in \@rest without a corresponding SPEC will be ignored (i.e. the "$arg is 78 # not a valid option" error won't occur)\n"; 79 my $allow_extra_options = pop @rest; 80 if (defined ($allow_extra_options)) { 81 if ($allow_extra_options eq "allow_extra_options") { 82 $allow_extra_options = 1; 83 } else { 84 # put it back where we got it 85 push (@rest, $allow_extra_options); 86 $allow_extra_options = 0; 87 } 88 } else { 89 $allow_extra_options = 0; 90 } 91 92 while (($spec, $var) = splice(@rest, 0, 2)) 93 { 74 94 die "Variable for $spec is not a valid type." 75 95 unless ref($var) eq 'SCALAR' || ref($var) eq 'ARRAY'; … … 126 146 &process_arg($option{$arg}, $arglist, \$errors); 127 147 } 128 els e148 elsif (!$allow_extra_options) 129 149 { 130 150 print STDERR "$arg is not a valid option.\n";
Note:
See TracChangeset
for help on using the changeset viewer.