summaryrefslogtreecommitdiff
path: root/debian/patches/0700-getopt_mixed.patch
blob: ccdae8b1ca072df5a47f2ad10c6af3e811be7f83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
Description: replace deprecated dependency libgetopt-mixed-perl
Author: Jörg Frings-Fürst <debian@jff-webhosting.net>
Bug: https://github.com/chilts/cil/issues/16
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829577
Last-Update: 2016-11-20
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: trunk/lib/CIL/Mixed.pm
===================================================================
--- /dev/null
+++ trunk/lib/CIL/Mixed.pm
@@ -0,0 +1,804 @@
+#---------------------------------------------------------------------
+package CIL::Mixed;
+#
+# Copyright 1995 Christopher J. Madsen
+#
+# Author: Christopher J. Madsen <perl@cjmweb.net>
+# Created: 1 Jan 1995
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the same terms as Perl itself.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See either the
+# GNU General Public License or the Artistic License for more details.
+#
+# ABSTRACT: [OBSOLETE] getopt processing with both long and short options
+#---------------------------------------------------------------------
+
+require 5.000;
+use strict;
+use Carp;
+
+use vars qw(
+    @EXPORT @EXPORT_OK @ISA %options
+    $PERMUTE $REQUIRE_ORDER $RETURN_IN_ORDER $VERSION
+    $badOption $checkArg $checkType $floatRegexp $group $ignoreCase
+    $intRegexp $option $optionEnd $optionStart $order $typeChars
+);
+
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT = ();
+@EXPORT_OK = qw(abortMsg getOptions nextOption);
+
+#=====================================================================
+# Package Global Variables:
+
+BEGIN
+{
+    $VERSION = '1.12';
+
+    # The permissible settings for $order:
+    $REQUIRE_ORDER   = 0;
+    $PERMUTE         = 1;
+    $RETURN_IN_ORDER = 2;
+
+    # Regular expressions:
+    $intRegexp   = '^[-+]?\d+$';               # Match an integer
+    $floatRegexp = '^[-+]?(\d*\.?\d+|\d+\.)$'; # Match a real number
+    $typeChars   = 'sif';                      # Match type characters
+} # end BEGIN
+
+#=====================================================================
+# Subroutines:
+#---------------------------------------------------------------------
+# Initialize the option processor:
+#
+# You should set any customization variables *after* calling init.
+#
+# For a description of option declarations, see the documentation at
+# the end of this file.
+#
+# Input:
+#   List of option declarations (separated by whitespace)
+#     If the first argument is entirely non-alphanumeric characters
+#     with no whitespace, it is the characters that start options.
+
+sub init
+{
+    undef %options;
+    my($opt,$type);
+
+    $ignoreCase  = 1;           # Ignore case by default
+    $optionStart = "-";         # Dash is the default option starter
+
+    # If the first argument is entirely non-alphanumeric characters
+    # with no whitespace, it is the desired value for $optionStart:
+    $optionStart = shift @_ if $_[0] =~ /^[^a-z0-9\s]+$/i;
+
+    foreach $group (@_) {
+        # Ignore case unless there are upper-case options:
+        $ignoreCase = 0 if $group =~ /[A-Z]/;
+        foreach $option (split(/\s+/,$group)) {
+            croak "Invalid option declaration `$option'"
+                unless $option =~ /^([^=:>]+)([=:][$typeChars]|>[^=:>]+)?$/o;
+            $opt  = $1;
+            $type = $2 || "";
+            if ($type =~ /^>(.*)$/) {
+                $type = $1;
+                croak "Invalid synonym `$option'"
+                    if (not defined $options{$type}
+                        or $options{$type} =~ /^[^:=]/);
+            } # end if synonym
+            $options{$opt} = $type;
+        } # end foreach option
+    } # end foreach group
+
+    # Handle POSIX compliancy:
+    if (defined $ENV{"POSIXLY_CORRECT"}) {
+        $order = $REQUIRE_ORDER;
+    } else {
+        $order = $PERMUTE;
+    }
+
+    $optionEnd = 0;
+    $badOption = \&badOption;
+    $checkArg  = \&checkArg;
+} # end init
+
+#---------------------------------------------------------------------
+# Clean up when we're done:
+#
+# This just releases the memory used by the %options hash.
+#
+# If 'help' was defined as an option, a new hash with just 'help' is
+# created, in case the program calls abortMsg.
+
+sub cleanup
+{
+    my $help = defined($options{'help'});
+    undef %options;
+    $options{'help'} = "" if $help;
+} # end cleanup
+
+#---------------------------------------------------------------------
+# Abort program with message:
+#
+# Prints program name and arguments to STDERR
+# If --help is an option, prints message saying 'Try --help'
+# Exits with code 1
+
+sub abortMsg
+{
+    my $name = $0;
+    $name =~ s|^.+[\\/]||;      # Remove any directories from name
+    print STDERR $name,": ",@_,"\n";
+    print STDERR "Try `$name --help' for more information.\n"
+        if defined $options{"help"};
+    exit 1;
+} # end abortMsg
+
+#---------------------------------------------------------------------
+# Standard function for handling bad options:
+#
+# Prints an error message and exits.
+#
+# You can override this by setting $Getopt::Mixed::badOption to a
+# function reference.
+#
+# Input:
+#   Index into @ARGV
+#   The option that caused the error
+#   An optional string describing the problem
+#     Currently, this can be
+#       undef        The option was not recognized
+#       'ambiguous'  The option could match several long options
+#
+# Note:
+#   The option has already been removed from @ARGV.  To put it back,
+#   you can say:
+#     splice(@ARGV,$_[0],0,$_[1]);
+#
+#   If your function returns, it should return whatever you want
+#   nextOption to return.
+
+sub badOption
+{
+    my ($index, $option, $problem) = @_;
+
+    $problem = 'unrecognized' unless $problem;
+
+    abortMsg("$problem option `$option'");
+} # end badOption
+
+#---------------------------------------------------------------------
+# Make sure we have the proper argument for this option:
+#
+# You can override this by setting $Getopt::Mixed::checkArg to a
+# function reference.
+#
+# Input:
+#   $i:       Position of argument in @ARGV
+#   $value:   The text appended to the option (undef if no text)
+#   $option:  The pretty name of the option (as the user typed it)
+#   $type:    The type of the option
+#
+# Returns:
+#   The value of the option's argument
+
+sub checkArg
+{
+    my ($i,$value,$option,$type) = @_;
+
+    abortMsg("option `$option' does not take an argument")
+        if (not $type and defined $value);
+
+    if ($type =~ /^=/) {
+        # An argument is required for this option:
+        $value = splice(@ARGV,$i,1) unless defined $value;
+        abortMsg("option `$option' requires an argument")
+            unless defined $value;
+    }
+
+    if ($type =~ /i$/) {
+        abortMsg("option `$option' requires integer argument")
+            if (defined $value and $value !~ /$intRegexp/o);
+    }
+    elsif ($type =~ /f$/) {
+        abortMsg("option `$option' requires numeric argument")
+            if (defined $value and $value !~ /$floatRegexp/o);
+    }
+    elsif ($type =~ /^[=:]/ and ref($checkType)) {
+        $value = &$checkType($i,$value,$option,$type);
+    }
+
+    $value = "" if not defined $value and $type =~ /^:/;
+
+    $value;
+} # end checkArg
+
+#---------------------------------------------------------------------
+# Find a match for an incomplete long option:
+#
+# Input:
+#   The option text to match
+#
+# Returns:
+#   The option that matched, or
+#   undef, if no option matched, or
+#   (undef, 'ambiguous'), if multiple options matched
+
+sub findMatch
+{
+    my $opt = shift;
+
+    $opt =~ s/-/[^-]*-/g;
+    $opt .= ".*";
+
+    my @matches = grep(/^$opt$/, keys %options);
+
+    return undef       if $#matches <  0;
+    return $matches[0] if $#matches == 0;
+
+    $opt = $matches[0];
+    $opt = $options{$opt} if $options{$opt} =~ /^[^=:]/;
+
+    foreach (@matches) {
+        return (undef, 'ambiguous')
+            unless $_ eq $opt or $options{$_} eq $opt;
+    }
+
+    $opt;
+} # end findMatch
+
+#---------------------------------------------------------------------
+# Return the next option:
+#
+# Returns a list of 3 elements:  (OPTION, VALUE, PRETTYNAME), where
+#   OPTION is the name of the option,
+#   VALUE is its argument, and
+#   PRETTYNAME is the option as the user entered it.
+# Returns the null list if there are no more options to process
+#
+# If $order is $RETURN_IN_ORDER, and this is a normal argument (not an
+# option), OPTION will be the null string, VALUE will be the argument,
+# and PRETTYNAME will be undefined.
+
+sub nextOption
+{
+    return () if $#ARGV < 0;    # No more arguments
+
+    if ($optionEnd) {
+        # We aren't processing any more options:
+        return ("", shift @ARGV) if $order == $RETURN_IN_ORDER;
+        return ();
+    }
+
+    # Find the next option:
+    my $i = 0;
+    while (length($ARGV[$i]) < 2 or
+           index($optionStart,substr($ARGV[$i],0,1)) < 0) {
+        return ()                if $order == $REQUIRE_ORDER;
+        return ("", shift @ARGV) if $order == $RETURN_IN_ORDER;
+        ++$i;
+        return () if $i > $#ARGV;
+    } # end while
+
+    # Process the option:
+    my($option,$opt,$value,$optType,$prettyOpt);
+    $option = $ARGV[$i];
+    if (substr($option,0,1) eq substr($option,1,1)) {
+        # If the option start character is repeated, it's a long option:
+        splice @ARGV,$i,1;
+        if (length($option) == 2) {
+            # A double dash by itself marks the end of the options:
+            $optionEnd = 1;     # Don't process any more options
+            return nextOption();
+        } # end if bare double dash
+        $opt = substr($option,2);
+        if ($opt =~ /^([^=]+)=(.*)$/) {
+            $opt = $1;
+            $value = $2;
+        } # end if option is followed by value
+        $opt =~ tr/A-Z/a-z/ if $ignoreCase;
+        $prettyOpt = substr($option,0,2) . $opt;
+        my $problem;
+        ($opt, $problem) = findMatch($opt)
+            unless defined $options{$opt} and length($opt) > 1;
+        return &$badOption($i,$option,$problem) unless $opt;
+        $optType = $options{$opt};
+        if ($optType =~ /^[^:=]/) {
+            $opt = $optType;
+            $optType = $options{$opt};
+        }
+        $value = &$checkArg($i,$value,$prettyOpt,$optType);
+    } # end if long option
+    else {
+        # It's a short option:
+        $opt = substr($option,1,1);
+        $opt =~ tr/A-Z/a-z/ if $ignoreCase;
+        return &$badOption($i,$option) unless defined $options{$opt};
+        $optType = $options{$opt};
+        if ($optType =~ /^[^:=]/) {
+            $opt = $optType;
+            $optType = $options{$opt};
+        }
+        if (length($option) == 2 or $optType) {
+            # This is the last option in the group, so remove the group:
+            splice(@ARGV,$i,1);
+        } else {
+            # Just remove this option from the group:
+            substr($ARGV[$i],1,1) = "";
+        }
+        if ($optType) {
+            $value = (length($option) > 2) ? substr($option,2) : undef;
+            $value =~ s/^=// if $value; # Allow either -d3 or -d=3
+        } # end if option takes an argument
+        $prettyOpt = substr($option,0,2);
+        $value = &$checkArg($i,$value,$prettyOpt,$optType);
+    } # end else short option
+    ($opt,$value,$prettyOpt);
+} # end nextOption
+
+#---------------------------------------------------------------------
+# Get options:
+#
+# Input:
+#   The same as for init()
+#   If no parameters are supplied, init() is NOT called.  This allows
+#   you to call init() yourself and then change the configuration
+#   variables.
+#
+# Output Variables:
+#   Sets $opt_X for each `-X' option encountered.
+#
+#   Note that if --apple is a synonym for -a, then --apple will cause
+#   $opt_a to be set, not $opt_apple.
+
+sub getOptions
+{
+    &init if $#_ >= 0;        # Pass arguments (if any) on to init
+
+    # If you want to use $RETURN_IN_ORDER, you have to call
+    # nextOption yourself; getOptions doesn't support it:
+    $order = $PERMUTE if $order == $RETURN_IN_ORDER;
+
+    my ($option,$value,$package);
+
+    $package = (caller)[0];
+
+    while (($option, $value) = nextOption()) {
+        $option =~ s/\W/_/g;    # Make a legal Perl identifier
+        $value = 1 unless defined $value;
+        my $code = "\$" . $package . "::opt_$option = \$value;";
+        $code =~ /(.+)/;        # Untaint it
+        eval $1;
+    } # end while
+
+    cleanup();
+} # end getOptions
+
+#=====================================================================
+# Package return value:
+
+$VERSION;
+
+__END__
+
+=head1 NAME
+
+Getopt::Mixed - [OBSOLETE] getopt processing with both long and short options
+
+=head1 VERSION
+
+This document describes version 1.12 of
+Getopt::Mixed, released February 8, 2014.
+
+=head1 SYNOPSIS
+
+    use Getopt::Mixed;
+    Getopt::Mixed::getOptions(...option-descriptions...);
+    ...examine $opt_* variables...
+
+or
+
+    use Getopt::Mixed "nextOption";
+    Getopt::Mixed::init(...option-descriptions...);
+    while (($option, $value) = nextOption()) {
+        ...process option...
+    }
+    Getopt::Mixed::cleanup();
+
+=head1 DESCRIPTION
+
+B<This module is obsolete.>
+
+This package was my response to the standard modules Getopt::Std and
+Getopt::Long.  Std doesn't support long options, and Long
+didn't support short options.  I wanted both, since long options are
+easier to remember and short options are faster to type.
+
+However, years ago Getopt::Long was changed to support short
+options as well, and it has the huge advantage of being part of the
+standard Perl distribution.  So, Getopt::Mixed is now effectively
+obsolete.  I don't intend to make any more changes, but I'm leaving it
+available for people who have code that already uses it.  For new
+modules, I recommend using Getopt::Long like this:
+
+    use Getopt::Long 2.17; # Released with Perl 5.005
+    Getopt::Long::Configure(qw(bundling no_getopt_compat));
+    GetOptions(...option-descriptions...);
+
+This package was intended to be the "Getopt-to-end-all-Getop's".  It
+combines (I hope) flexibility and simplicity.  It supports both short
+options (introduced by C<->) and long options (introduced by C<-->).
+Short options which do not take an argument can be grouped together.
+Short options which do take an argument must be the last option in
+their group, because everything following the option will be
+considered to be its argument.
+
+There are two methods for using Getopt::Mixed:  the simple method and
+the flexible method.  Both methods use the same format for option
+descriptions.
+
+=head2 Option Descriptions
+
+The option-description arguments required by C<init> and C<getOptions>
+are strings composed of individual option descriptions.  Several
+option descriptions can appear in the same string if they are
+separated by whitespace.
+
+Each description consists of the option name and an optional trailing
+argument specifier.  Option names may consist of any characters but
+whitespace, C<=>, C<:>, and C<E<gt>>.
+
+Values for argument specifiers are:
+
+  <none>   option does not take an argument
+  =s :s    option takes a mandatory (=) or optional (:) string argument
+  =i :i    option takes a mandatory (=) or optional (:) integer argument
+  =f :f    option takes a mandatory (=) or optional (:) real number argument
+  >new     option is a synonym for option `new'
+
+The C<E<gt>> specifier is not really an argument specifier.  It
+defines an option as being a synonym for another option.  For example,
+"a=i apples>a" would define B<-a> as an option that requires an
+integer argument and B<--apples> as a synonym for B<-a>.  Only one
+level of synonyms is supported, and the root option must be listed
+first.  For example, "apples>a a=i" and "a=i apples>a oranges>apples"
+are illegal; use "a=i apples>a oranges>a" if that's what you want.
+
+For example, in the option description:
+     "a b=i c:s apple baker>b charlie:s"
+         -a and --apple do not take arguments
+         -b takes a mandatory integer argument
+         --baker is a synonym for -b
+         -c and --charlie take an optional string argument
+
+If the first argument to C<init> or C<getOptions> is entirely
+non-alphanumeric characters with no whitespace, it represents the
+characters which can begin options.
+
+=head2 User Interface
+
+From the user's perspective, short options are introduced by a dash
+(C<->) and long options are introduced by a double dash (C<-->).
+Short options may be combined ("-a -b" can be written "-ab"), but an
+option that takes an argument must be the last one in its group,
+because anything following it is considered part of the argument.  A
+double dash by itself marks the end of the options; all arguments
+following it are treated as normal arguments, not options.  A single
+dash by itself is treated as a normal argument, I<not> an option.
+
+Long options may be abbreviated.  An option B<--all-the-time> could be
+abbreviated B<--all>, B<--a--tim>, or even B<--a>.  Note that B<--time>
+would not work; the abbreviation must start at the beginning of the
+option name.  If an abbreviation is ambiguous, an error message will
+be printed.
+
+In the following examples, B<-i> and B<--int> take integer arguments,
+B<-f> and B<--float> take floating point arguments, and B<-s> and
+B<--string> take string arguments.  All other options do not take an
+argument.
+
+  -i24            -f24.5               -sHello
+  -i=24 --int=-27 -f=24.5 --float=0.27 -s=Hello --string=Hello
+
+If the argument is required, it can also be separated by whitespace:
+
+  -i 24 --int -27 -f 24.5 --float 0.27 -s Hello --string Hello
+
+Note that if the option is followed by C<=>, whatever follows the C<=>
+I<is> the argument, even if it's the null string.  In the example
+
+  -i= 24 -f= 24.5 -s= Hello
+
+B<-i> and B<-f> will cause an error, because the null string is not a
+number, but B<-s> is perfectly legal; its argument is the null string,
+not "Hello".
+
+Remember that optional arguments I<cannot> be separated from the
+option by whitespace.
+
+=head2 The Simple Method
+
+The simple method is
+
+    use Getopt::Mixed;
+    Getopt::Mixed::getOptions(...option-descriptions...);
+
+You then examine the C<$opt_*> variables to find out what options were
+specified and the C<@ARGV> array to see what arguments are left.
+
+If B<-a> is an option that doesn't take an argument, then C<$opt_a>
+will be set to 1 if the option is present, or left undefined if the
+option is not present.
+
+If B<-b> is an option that takes an argument, then C<$opt_b> will be
+set to the value of the argument if the option is present, or left
+undefined if the option is not present.  If the argument is optional
+but not supplied, C<$opt_b> will be set to the null string.
+
+Note that even if you specify that an option I<requires> a string
+argument, you can still get the null string (if the user specifically
+enters it).  If the option requires a numeric argument, you will never
+get the null string (because it isn't a number).
+
+When converting the option name to a Perl identifier, any non-word
+characters in the name will be converted to underscores (C<_>).
+
+If the same option occurs more than once, only the last occurrence
+will be recorded.  If that's not acceptable, you'll have to use the
+flexible method instead.
+
+=head2 The Flexible Method
+
+The flexible method is
+
+    use Getopt::Mixed "nextOption";
+    Getopt::Mixed::init(...option-descriptions...);
+    while (($option, $value, $pretty) = nextOption()) {
+        ...process option...
+    }
+    Getopt::Mixed::cleanup();
+
+This lets you process arguments one at a time.  You can then handle
+repeated options any way you want to.  It also lets you see option
+names with non-alphanumeric characters without any translation.  This
+is also the only method that lets you find out what order the options
+and other arguments were in.
+
+First, you call Getopt::Mixed::init with the option descriptions.
+Then, you keep calling nextOption until it returns an empty list.
+Finally, you call Getopt::Mixed::cleanup when you're done.  The
+remaining (non-option) arguments will be found in C<@ARGV>.
+
+Each call to nextOption returns a list of the next option, its value,
+and the option as the user typed it.  The value will be undefined if
+the option does not take an argument.  The option is stripped of its
+starter (e.g., you get "a" and "foo", not "-a" or "--foo").  If you
+want to print an error message, use the third element, which does
+include the option starter.
+
+=head1 OTHER FUNCTIONS
+
+Getopt::Mixed provides one other function you can use.  C<abortMsg>
+prints its arguments on STDERR, plus your program's name and a
+newline.  It then exits with status 1.  For example, if F<foo.pl>
+calls C<abortMsg> like this:
+
+  Getopt::Mixed::abortMsg("Error");
+
+The output will be:
+
+  foo.pl: Error
+
+=head1 CUSTOMIZATION
+
+There are several customization variables you can set.  All of these
+variables should be set I<after> calling Getopt::Mixed::init and
+I<before> calling nextOption.
+
+If you set any of these variables, you I<must> check the version
+number first.  The easiest way to do this is like this:
+
+    use Getopt::Mixed 1.006;
+
+If you are using the simple method, and you want to set these
+variables, you'll need to call init before calling getOptions, like
+this:
+
+    use Getopt::Mixed 1.006;
+    Getopt::Mixed::init(...option-descriptions...);
+    ...set configuration variables...
+    Getopt::Mixed::getOptions();      # IMPORTANT: no parameters
+
+=over 4
+
+=item $order
+
+$order can be set to $REQUIRE_ORDER, $PERMUTE, or $RETURN_IN_ORDER.
+The default is $REQUIRE_ORDER if the environment variable
+POSIXLY_CORRECT has been set, $PERMUTE otherwise.
+
+$REQUIRE_ORDER means that no options can follow the first argument
+which isn't an option.
+
+$PERMUTE means that all options are treated as if they preceded all
+other arguments.
+
+$RETURN_IN_ORDER means that all arguments maintain their ordering.
+When nextOption is called, and the next argument is not an option, it
+returns the null string as the option and the argument as the value.
+nextOption never returns the null list until all the arguments have
+been processed.
+
+=item $ignoreCase
+
+Ignore case when matching options.  Default is 1 unless the option
+descriptions contain an upper-case letter.
+
+=item $optionStart
+
+A string of characters that can start options.  Default is "-".
+
+=item $badOption
+
+A reference to a function that is called when an unrecognized option
+is encountered.  The function receives three arguments.  C<$_[0]> is the
+position in C<@ARGV> where the option came from.  C<$_[1]> is the option as
+the user typed it (including the option start character).  C<$_[2]> is
+either undef or a string describing the reason the option was not
+recognized (Currently, the only possible value is 'ambiguous', for a
+long option with several possible matches).  The option has already
+been removed from C<@ARGV>.  To put it back, you can say:
+
+    splice(@ARGV,$_[0],0,$_[1]);
+
+The function can do anything you want to C<@ARGV>.  It should return
+whatever you want nextOption to return.
+
+The default is a function that prints an error message and exits the
+program.
+
+=item $checkArg
+
+A reference to a function that is called to make sure the argument
+type is correct.  The function receives four arguments.  C<$_[0]> is the
+position in C<@ARGV> where the option came from.  C<$_[1]> is the text
+following the option, or undefined if there was no text following the
+option.  C<$_[2]> is the name of the option as the user typed it
+(including the option start character), suitable for error messages.
+C<$_[3]> is the argument type specifier.
+
+The function can do anything you want to C<@ARGV>.  It should return
+the value for this option.
+
+The default is a function that prints an error message and exits the
+program if the argument is not the right type for the option.  You can
+also adjust the behavior of the default function by changing
+C<$intRegexp> or C<$floatRegexp>.
+
+=item $intRegexp
+
+A regular expression that matches an integer.  Default is
+'^[-+]?\d+$', which matches a string of digits preceded by an
+optional sign.  Unlike the other configuration variables, this cannot
+be changed after nextOption is called, because the pattern is compiled
+only once.
+
+=item $floatRegexp
+
+A regular expression that matches a floating point number.  Default is
+'^[-+]?(\d*\.?\d+|\d+\.)$', which matches the following formats:
+"123", "123.", "123.45", and ".123" (plus an optional sign).  It does
+not match exponential notation.  Unlike the other configuration
+variables, this cannot be changed after nextOption is called, because
+the pattern is compiled only once.
+
+=item $typeChars
+
+A string of the characters which are legal argument types.  The
+default is 'sif', for String, Integer, and Floating point arguments.
+The string should consist only of letters.  Upper case letters are
+discouraged, since this will hamper the case-folding of options.  If
+you change this, you should set $checkType to a function that will
+check arguments of your new type.  Unlike the other configuration
+variables, this must be set I<before> calling init(), and cannot be
+changed afterwards.
+
+=item $checkType
+
+If you add new types to C<$typeChars>, you should set this to a function
+which will check arguments of the new types.
+
+=back
+
+=head1 SEE ALSO
+
+L<Getopt::Long>
+
+=head1 CONFIGURATION AND ENVIRONMENT
+
+Getopt::Mixed requires no configuration files or environment variables.
+
+=head1 INCOMPATIBILITIES
+
+None reported.
+
+=head1 BUGS AND LIMITATIONS
+
+=over 4
+
+=item *
+
+This document should be expanded.
+
+=item *
+
+A long option must be at least two characters long.  Sorry.
+
+=item *
+
+The C<!> argument specifier of Getopt::Long is not supported, but you
+could have options B<--foo> and B<--nofoo> and then do something like:
+
+    $opt_foo = 0 if $opt_nofoo;
+
+=item *
+
+The C<@> argument specifier of Getopt::Long is not supported.  If you
+want your values pushed into an array, you'll have to use nextOption
+and do it yourself.
+
+=back
+
+=head1 AUTHOR
+
+Christopher J. Madsen  S<C<< <perl AT cjmweb.net> >>>
+
+Please report any bugs or feature requests
+to S<C<< <bug-Getopt-Mixed AT rt.cpan.org> >>>
+or through the web interface at
+L<< http://rt.cpan.org/Public/Bug/Report.html?Queue=Getopt-Mixed >>.
+
+You can follow or contribute to Getopt::Mixed's development at
+L<< http://github.com/madsen/getopt-mixed >>.
+
+Thanks are also due to Andreas Koenig for helping Getopt::Mixed
+conform to the standards for Perl modules and for answering a bunch of
+questions.  Any remaining deficiencies are my fault.
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 1995 by Christopher J. Madsen.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=head1 DISCLAIMER OF WARRANTY
+
+BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
+YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR, OR CORRECTION.
+
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
+LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
+THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+=cut
Index: trunk/Build.PL
===================================================================
--- trunk.orig/Build.PL
+++ trunk/Build.PL
@@ -21,7 +21,6 @@ my $builder = Module::Build->new(
         'File::Spec'       => 0,
         'File::Temp'       => 0,
         'File::Touch'      => 0,
-        'Getopt::Mixed'    => 0,
         'MIME::Base64'     => 0,
         'Test::More'       => 0,
     },
Index: trunk/MANIFEST
===================================================================
--- trunk.orig/MANIFEST
+++ trunk/MANIFEST
@@ -10,6 +10,7 @@ lib/CIL/Base.pm
 lib/CIL/Comment.pm
 lib/CIL/Issue.pm
 lib/CIL/Utils.pm
+lib/CIL/Mixed.pm
 MANIFEST			This list of files
 README
 t/00_files.t
Index: trunk/bin/cil
===================================================================
--- trunk.orig/bin/cil
+++ trunk/bin/cil
@@ -20,7 +20,7 @@
 use strict;
 use warnings;
 
-use Getopt::Mixed "nextOption";
+#use Getopt::Mixed "nextOption";
 use File::Touch;
 use File::Glob ':glob';
 use File::Basename;
@@ -33,6 +33,7 @@ use CIL::Issue;
 use CIL::Comment;
 use CIL::Attachment;
 use CIL::Utils;
+use CIL::Mixed "nextOption";
 
 ## ----------------------------------------------------------------------------
 # constants
@@ -100,12 +101,12 @@ my %BOOLEAN_ARGS = (
     }
 
     # make sure that the command given is valid
-    Getopt::Mixed::abortMsg('specify a command')
+    CIL::Mixed::abortMsg('specify a command')
        if @ARGV == 0;
 
     my $command_name = shift @ARGV;
     my( $command ) =  grep { $command_name eq $_->name } CIL->commands
-        or Getopt::Mixed::abortMsg("'$command_name' is not a valid cil command.");
+        or CIL::Mixed::abortMsg("'$command_name' is not a valid cil command.");
 
     # make a new $cil object
     my $cil = CIL->new();
@@ -136,7 +137,7 @@ sub get_options {
     my ($in_opts, $booleans) = @_;
 
     my $args = {};
-    Getopt::Mixed::init( @$in_opts );
+    CIL::Mixed::init( @$in_opts );
     while( my($opt, $val) = nextOption() ) {
         # if boolean, keep a count of how many there is only
         if ( exists $booleans->{$opt} ) {
@@ -154,7 +155,7 @@ sub get_options {
             $args->{$opt} = $val;
         }
     }
-    Getopt::Mixed::cleanup();
+    CIL::Mixed::cleanup();
     return $args;
 }