1Getopt::Euclid(3) User Contributed Perl Documentation Getopt::Euclid(3)
2
3
4
6 Getopt::Euclid - Executable Uniform Command-Line Interface Descriptions
7
9 This document describes Getopt::Euclid version 0.2.3
10
12 use Getopt::Euclid;
13
14 if ($ARGV{-i}) {
15 print "Interactive mode...\n";
16 }
17
18 for my $x (0..$ARGV{-size}{h}-1) {
19 for my $y (0..$ARGV{-size}{w}-1) {
20 do_something_with($x, $y);
21 }
22 }
23
24 __END__
25
26 =head1 NAME
27
28 yourprog - Your program here
29
30 =head1 VERSION
31
32 This documentation refers to yourprog version 1.9.4
33
34 =head1 USAGE
35
36 yourprog [options] -s[ize]=<h>x<w> -o[ut][file] <file>
37
38 =head1 REQUIRED ARGUMENTS
39
40 =over
41
42 =item -s[ize]=<h>x<w>
43
44 Specify size of simulation
45
46 =for Euclid:
47 h.type: int > 0
48 h.default: 24
49 w.type: int >= 10
50 w.default: 80
51
52 =item -o[ut][file] <file>
53
54 Specify output file
55
56 =for Euclid:
57 file.type: writable
58 file.default: '-'
59
60 =back
61
62 =head1 OPTIONS
63
64 =over
65
66 =item -i
67
68 Specify interactive simulation
69
70 =item -l[[en][gth]] <l>
71
72 Length of simulation [default: 99]
73
74 =for Euclid:
75 l.type: int > 0
76 l.default: 99
77
78 =item --version
79
80 =item --usage
81
82 =item --help
83
84 =item --man
85
86 Print the usual program information
87
88 =back
89
90 Remainder of documentation starts here...
91
92 =head1 AUTHOR
93
94 Damian Conway (DCONWAY@CPAN.org)
95
96 =head1 BUGS
97
98 There are undoubtedly serious bugs lurking somewhere in this code.
99 Bug reports and other feedback are most welcome.
100
101 =head1 COPYRIGHT
102
103 Copyright (c) 2005, Damian Conway. All Rights Reserved.
104 This module is free software. It may be used, redistributed
105 and/or modified under the terms of the Perl Artistic License
106 (see http://www.perl.com/perl/misc/Artistic.html)
107
109 Getopt::Euclid uses your program's own documentation to create a
110 command-line argument parser. This ensures that your program's
111 documented interface and its actual interface always agree.
112
113 To use the module, you simply write:
114
115 use Getopt::Euclid;
116
117 at the top of your program. This will cause Getopt::Euclid to be
118 required and its import method will be called. It is important that the
119 import method be allowed to run, so do not invoke Getopt::Euclid in the
120 following manner:
121
122 # Will not work
123 use Getopt::Euclid ();
124
125 When the module is loaded within a regular Perl program, it will:
126
127 1. locate any POD in the same file,
128
129 2. extract information from that POD, most especially from the "=head1
130 REQUIRED ARGUMENTS" and "=head1 OPTIONS" sections,
131
132 3. build a parser that parses the arguments and options the POD
133 specifies,
134
135 4. remove the command-line arguments from @ARGV and parse them, and
136
137 5. put the results in the global %ARGV variable (or into specifically
138 named optional variables, if you request that -- see "Exporting
139 Option Variables").
140
141 As a special case, if the module is loaded within some other module
142 (i.e. from within a ".pm" file), it still locates and extracts POD
143 information, but instead of parsing @ARGV immediately, it caches that
144 information and installs an "import()" subroutine in the caller module.
145 That new "import()" acts just like Getopt::Euclid's own import, except
146 that it adds the POD from the caller module to the POD of the callee.
147
148 All of which just means you can put some or all of your CLI
149 specification in a module, rather than in the application's source
150 file. See "Module Interface" for more details.
151
153 Program Interface
154 You write:
155
156 use Getopt::Euclid;
157
158 and your command-line is parsed automagically.
159
160 Module Interface
161 You write:
162
163 use Getopt::Euclid;
164
165 and your module will then act just like Getopt::Euclid (i.e. you can
166 use your module instead of Getopt::Euclid>, except that your module's
167 POD will also be prepended to the POD of any module that loads yours.
168 In other words, you can use Getopt::Euclid in a module to create a
169 standard set of CLI arguments, which can then be added to any
170 application simply by loading your module.
171
172 To accomplish this trick Getopt::Euclid installs an "import()"
173 subroutine in your module. If your module already has an "import()"
174 subroutine defined, terrible things happen. So don't do that.
175
176 You may also short-circuit the import method within your calling
177 program to have the POD from several modules included for argument
178 parsing.
179
180 use Module1::Getopt (); # No argument parsing
181 use Module2::Getopt (); # No argument parsing
182 use Getopt::Euclid; # Arguments parsed
183
184 POD Interface
185 This is where all the action is.
186
187 When Getopt::Euclid is loaded in a non-".pm" file, it searches that
188 file for the following POD documentation:
189
190 =head1 NAME
191 Getopt::Euclid ignores the name specified here. In fact, if you use
192 the standard "--help", "--usage", "--man", or "--version" arguments
193 (see "Standard arguments"), the module replaces the name specified
194 in this POD section with the actual name by which the program was
195 invoked (i.e. with $0).
196
197 =head1 USAGE
198 Getopt::Euclid ignores the usage line specified here. If you use
199 the standard "--help", "--usage", or "--man" arguments, the module
200 replaces the usage line specified in this POD section with a usage
201 line that reflects the actual interface that the module has
202 constructed.
203
204 =head1 VERSION
205 Getopt::Euclid extracts the current version number from this POD
206 section. To do that it simply takes the first substring that
207 matches <digit>.<digit> or <digit>_<digit>. It also accepts one or
208 more additional trailing .<digit> or _<digit>, allowing for multi-
209 level and "alpha" version numbers such as:
210
211 =head1 VERSION
212
213 This is version 1.2.3
214
215 or:
216
217 =head1 VERSION
218
219 This is alpha release 1.2_34
220
221 You may also specify the version number in your code. However, in
222 order for Getopt::Euclid to properly read it, it must be in a
223 "BEGIN" block:
224
225 BEGIN { use version; our $VERSION = qv('1.2.3') }
226 use Getopt::Euclid;
227
228 Euclid stores the version as $Getopt::Euclid::SCRIPT_VERSION.
229
230 =head1 REQUIRED ARGUMENTS
231 Getopt::Euclid uses the specifications in this POD section to build
232 a parser for command-line arguments. That parser requires that
233 every one of the specified arguments is present in any command-line
234 invocation. See "Specifying arguments" for details of the
235 specification syntax.
236
237 The actual headings that Getopt::Euclid can recognize here are:
238
239 =head1 [STD|STANDARD] REQUIRED [ARG|ARGUMENT][S]
240
241 =head1 OPTIONS
242 Getopt::Euclid uses the specifications in this POD section to build
243 a parser for command-line arguments. That parser does not require
244 that any of the specified arguments is actually present in a
245 command-line invocation. Again, see "Specifying arguments" for
246 details of the specification syntax.
247
248 Typically a program will specify both "REQUIRED ARGUMENTS" and
249 "OPTIONS", but there is no requirement that it supply both, or
250 either.
251
252 The actual headings that Getopt::Euclid recognizes here are:
253
254 =head1 [STD|STANDARD] OPTION[AL|S] [ARG|ARGUMENT][S]
255
256 =head1 COPYRIGHT
257 Getopt::Euclid prints this section whenever the standard
258 "--version" option is specified on the command-line.
259
260 The actual heading that Getopt::Euclid recognizes here is any
261 heading containing any of the words "COPYRIGHT", "LICENCE", or
262 "LICENSE".
263
264 Specifying arguments
265 Each required or optional argument is specified in the POD in the
266 following format:
267
268 =item ARGUMENT_STRUCTURE
269
270 ARGUMENT_DESCRIPTION
271
272 =for Euclid:
273 ARGUMENT_OPTIONS
274 PLACEHOLDER_CONSTRAINTS
275
276 Argument structure
277
278 · Each argument is specified as an "=item".
279
280 · Any part(s) of the specification that appear in square brackets are
281 treated as optional.
282
283 · Any parts that appear in angle brackets are placeholders for actual
284 values that must be specified on the command-line.
285
286 · Any placeholder that is immediately followed by "..." may be
287 repeated as many times as desired.
288
289 · Any whitespace in the structure specifies that any amount of
290 whitespace (including none) is allowed at the same position on the
291 command-line.
292
293 · A vertical bar indicates the start of an alternative variant of the
294 argument.
295
296 For example, the argument specification:
297
298 =item -i[n] [=] <file> | --from <file>
299
300 indicates that any of the following may appear on the command-line:
301
302 -idata.txt -i data.txt -i=data.txt -i = data.txt
303
304 -indata.txt -in data.txt -in=data.txt -in = data.txt
305
306 --from data.text
307
308 as well as any other combination of whitespacing.
309
310 Any of the above variations would cause all three of:
311
312 $ARGV{'-i'}
313 $ARGV{'-in'}
314 $ARGV{'--from'}
315
316 to be set to the string 'data.txt'.
317
318 You could allow the optional "=" to also be an optional colon by
319 specifying:
320
321 =item -i[n] [=|:] <file>
322
323 Optional components may also be nested, so you could write:
324
325 =item -i[n[put]] [=] <file>
326
327 which would allow "-i", "-in", and "-input" as synonyms for this
328 argument and would set all three of $ARGV{'-i'}, $ARGV{'-in'}, and
329 $ARGV{'-input'} to the supplied file name.
330
331 The point of setting every possible variant within %ARGV is that this
332 allows you to use a single key (say $ARGV{'-input'}, regardless of how
333 the argument is actually specified on the command-line.
334
335 Repeatable arguments
336 Normally Getopt::Euclid only accepts each specified argument once, the
337 first time it appears in @ARGV. However, you can specify that an
338 argument may appear more than once, using the "repeatable" option:
339
340 =item file=<filename>
341
342 =for Euclid:
343 repeatable
344
345 When an argument is marked repeatable the corresponding entry of %ARGV
346 will not contain a single value, but rather an array reference. If the
347 argument also has "Multiple placeholders", then the corresponding entry
348 in %ARGV will be an array reference with each array entry being a hash
349 reference.
350
351 Boolean arguments
352 If an argument has no placeholders it is treated as a boolean switch
353 and it's entry in %ARGV will be true if the argument appeared in @ARGV.
354
355 For a boolean argument, you can also specify variations that are false,
356 if they appear. For example, a common idiom is:
357
358 =item --print
359
360 Print results
361
362 =item --noprint
363
364 Don't print results
365
366 These two arguments are effectively the same argument, just with
367 opposite boolean values. However, as specified above, only one of
368 $ARGV{'--print'} and $ARGV{'--noprint'} will be set.
369
370 As an alternative you can specify a single argument that accepts either
371 value and sets both appropriately:
372
373 =item --[no]print
374
375 [Don't] print results
376
377 =for Euclid:
378 false: --noprint
379
380 With this specification, if "--print" appears in @ARGV, then
381 $ARGV{'--print'} will be true and $ARGV{'--noprint'} will be false. On
382 the other hand, if "--noprint" appears in @ARGV, then $ARGV{'--print'}
383 will be false and $ARGV{'--noprint'} will be true.
384
385 The specified false values can follow any convention you wish:
386
387 =item [+|-]print
388
389 =for Euclid:
390 false: -print
391
392 or:
393
394 =item -report[_no[t]]
395
396 =for Euclid:
397 false: -report_no[t]
398
399 et cetera.
400
401 Multiple placeholders
402 An argument can have two or more placeholders:
403
404 =item -size <h> <w>
405
406 The corresponding command line argument would then have to provide two
407 values:
408
409 -size 24 80
410
411 Multiple placeholders can optionally be separated by literal characters
412 (which must then appear on the command-line). For example:
413
414 =item -size <h>x<w>
415
416 would then require a command-line of the form:
417
418 -size 24x80
419
420 If an argument has two or more placeholders, the corresponding entry in
421 %ARGV becomes a hash reference, with each of the placeholder names as
422 one key. That is, the above command-line would set both
423 $ARGV{'-size'}{'h'} and $ARGV{'-size'}{'w'}.
424
425 Optional placeholders
426 Placeholders can be specified as optional as well:
427
428 =item -size <h> [<w>]
429
430 This specification then allows either:
431
432 -size 24
433
434 or:
435
436 -size 24 80
437
438 on the command-line. If the second placeholder value is not provided,
439 the corresponding $ARGV{'-size'}{'w'} entry is set to "undef". See also
440 "Placeholder defaults".
441
442 Unflagged placeholders
443 If an argument consists of a single placeholder with no "flag" marking
444 it:
445
446 =item <filename>
447
448 then the corresponding entry in %ARG will have a key the same as the
449 placeholder (including the surrounding angle brackets):
450
451 if ($ARGV{'<filename>'} eq '-') {
452 $fh = \*STDIN;
453 }
454
455 The same is true for any more-complicated arguments that begin with a
456 placeholder:
457
458 =item <h> [x <w>]
459
460 The only difference in the more-complex cases is that, if the argument
461 has any additional placeholders, the entire entry in %ARGV becomes a
462 hash:
463
464 my $total_size
465 = $ARGV{'<h>'}{'h'} * $ARGV{'<h>'}{'w'}
466
467 Note that, as in earlier multi-placeholder examples, the individual
468 second- level placeholder keys don't retain their angle-brackets.
469
470 Repeated placeholders
471 Any placeholder that is immediately followed by "...", like so:
472
473 =item -lib <files>...
474
475 =item <offsets>...
476
477 =for Euclid:
478 offsets.type: integer > 0
479
480 will match as many times as possible, but at least once. Note that this
481 implies that an unconstrained repeated unflagged placeholder (see
482 "Placeholder constraints" and "Unflagged placeholders") will consume
483 the rest of the command-line, and so should be specified last in the
484 POD.
485
486 If a placeholder is repeated, the corresponding entry in %ARGV will
487 then be an array reference, with each individual placeholder match in a
488 separate element. For example:
489
490 for my $lib (@{ $ARGV{'-lib'} }) {
491 add_lib($lib);
492 }
493
494 warn "First offset is: $ARGV{'<offsets>'}[0]";
495 my $first_offset = shift @{ $ARGV{'<offsets>'} };
496
497 Placeholder constraints
498 You can specify that the value provided for a particular placeholder
499 must satisfy a particular set of restrictions by using a "=for Euclid"
500 block. For example:
501
502 =item -size <h>x<w>
503
504 =for Euclid:
505 h.type: integer
506 w.type: integer
507
508 specifies that both the "<h>" and "<w>" must be given integers. You
509 can also specify an operator expression after the type name:
510
511 =for Euclid:
512 h.type: integer > 0
513 w.type: number <= 100
514
515 specifies that "<h>" has to be given an integer that's greater than
516 zero, and that "<w>" has to be given a number (not necessarily an
517 integer) that's no more than 100.
518
519 These type constraints have two alternative syntaxes:
520
521 PLACEHOLDER.type: TYPE BINARY_OPERATOR EXPRESSION
522
523 as shown above, and the more general:
524
525 PLACEHOLDER.type: TYPE [, EXPRESSION_INVOLVING(PLACEHOLDER)]
526
527 Using the second syntax, you could write the previous constraints as:
528
529 =for Euclid:
530 h.type: integer, h > 0
531 w.type: number, w <= 100
532
533 In other words, the first syntax is just sugar for the most common case
534 of the second syntax. The expression can be as complex as you wish and
535 can refer to the placeholder as many times as necessary:
536
537 =for Euclid:
538 h.type: integer, h > 0 && h < 100
539 w.type: number, Math::is_prime(w) || w % 2 == 0
540
541 Note that the expressions are evaluated in the "package main"
542 namespace, so it's important to qualify any subroutines that are not in
543 that namespace. Furthermore, any subroutines used must be defined (or
544 loaded from a module) before the "use Getopt::Euclid" statement.
545
546 Standard placeholder types
547 Getopt::Euclid recognizes the following standard placeholder types:
548
549 Name Placeholder value... Synonyms
550 ============ ==================== ================
551
552 integer ...must be an integer int i
553
554 +integer ...must be a positive +int +i
555 integer
556 (same as: integer > 0)
557
558 0+integer ...must be a positive 0+int 0+i
559 integer or zero
560 (same as: integer >= 0)
561
562 number ...must be an number num n
563
564 +number ...must be a positive +num +n
565 number
566 (same as: number > 0)
567
568 0+number ...must be a positive 0+num 0+n
569 number or zero
570 (same as: number >= 0)
571
572 string ...may be any string str s
573 (default type)
574
575 readable ...must be the name input in
576 of a readable file
577
578 writeable ...must be the name writable output out
579 of a writeable file
580 (or of a non-existent
581 file in a writeable
582 directory)
583
584 /<regex>/ ...must be a string
585 matching the specified
586 pattern
587
588 Placeholder type errors
589 If a command-line argument's placeholder value doesn't satisify the
590 specified type, an error message is automatically generated. However,
591 you can provide your own message instead, using the ".type.error"
592 specifier:
593
594 =for Euclid:
595 h.type: integer, h > 0 && h < 100
596 h.type.error: <h> must be between 0 and 100 (not h)
597
598 w.type: number, Math::is_prime(w) || w % 2 == 0
599 w.type.error: Can't use w for <w> (must be an even prime number)
600
601 Whenever an explicit error message is provided, any occurrence within
602 the message of the placeholder's unbracketed name is replaced by the
603 placeholder's value (just as in the type test itself).
604
605 Placeholder defaults
606 You can also specify a default value for any placeholders that aren't
607 given values on the command-line (either because their argument isn't
608 provided at all, or because the placeholder is optional within the
609 argument).
610
611 For example:
612
613 =item -size <h>[x<w>]
614
615 Set the size of the simulation
616
617 =for Euclid:
618 h.default: 24
619 w.default: 80
620
621 This ensures that if no "<w>" value is supplied:
622
623 -size 20
624
625 then $ARGV{'-size'}{'w'} is set to 80.
626
627 Likewise, of the "-size" argument is omitted entirely, both
628 $ARGV{'-size'}{'h'} and $ARGV{'-size'}{'w'} are set to their respective
629 default values.
630
631 The default value can be any valid Perl compile-time expression:
632
633 =item -pi=<pi value>
634
635 =for Euclid:
636 pi value.default: atan2(0,-1)
637
638 Argument cuddling
639 Getopt::Euclid allows any "flag" argument to be "cuddled". A flag
640 argument consists of a single non- alphanumeric character, followed by
641 a single alpha-numeric character:
642
643 =item -v
644
645 =item -x
646
647 =item +1
648
649 =item =z
650
651 Cuddling means that two or more such arguments can be concatenated
652 after a single common non-alphanumeric. For example:
653
654 -vx
655
656 Note, however, that only flags with the same leading non-alphanumeric
657 can be cuddled together. Getopt::Euclid would not allow:
658
659 -vxz
660
661 That's because cuddling is recognized by progressively removing the
662 second character of the cuddle. In other words:
663
664 -vxz
665
666 becomes:
667
668 -v -xz
669
670 which becomes:
671
672 -v -x z
673
674 which will fail, unless a "z" argument has also been specified.
675
676 On the other hand, if the argument:
677
678 =item -e <cmd>
679
680 had been specified, the module would accept:
681
682 -vxe'print time'
683
684 as a cuddled version of:
685
686 -v -x -e'print time'
687
688 Exporting Option Variables
689 By default, the module only stores arguments into the global %ARGV
690 hash. You can request that options are exported as variables into the
691 calling package the special ':vars' specifier:
692
693 use Getopt::Euclid qw( :vars );
694
695 That is, if your program accepts the following arguments:
696
697 -v
698 --mode <modename>
699 <infile>
700 <outfile>
701 --auto-fudge <factor> (repeatable)
702 --also <a>...
703 --size <w>x<h>
704
705 Then these variables will be exported
706
707 $ARGV_v
708 $ARGV_mode
709 $ARGV_infile
710 $ARGV_outfile
711 @ARGV_auto_fudge
712 @ARGV_also
713 %ARGV_size # With entries $ARGV_size{w} and $ARGV_size{h}
714
715 For options that have multiple variants, only the longest variant is
716 exported.
717
718 The type of variable exported (scalar, hash, or array) is determined by
719 the type of the corresponding value in %ARGV. Command-line flags and
720 arguments that take single values will produce scalars, arguments that
721 take multiple values will produce hashes, and repeatable arguments will
722 produce arrays.
723
724 If you don't like the default prefix of "ARGV_", you can specify your
725 own, such as "opt_", like this:
726
727 use Getopt::Euclid qw( :vars<opt_> );
728
729 The major advantage of using exported variables is that any misspelling
730 of argument variables in your code will be caught at compile-time by
731 "use strict".
732
733 Standard arguments
734 Getopt::Euclid automatically provides four standard arguments to any
735 program that uses the module. The behaviours of these arguments are
736 "hard- wired" and cannot be changed, not even by defining your own
737 arguments of the same name.
738
739 The standard arguments are:
740
741 --usage
742 This argument cause the program to print a short usage summary and
743 exit.
744
745 --help
746 This argument cause the program to print a longer usage summary
747 (including a full list of required and optional arguments) and
748 exit.
749
750 --man
751 This argument cause the program to print the complete POD
752 documentation for the program and exit. If the standard output
753 stream is connected to a terminal and the POD::Text module is
754 available, the POD is formatted before printing. If the IO::Page or
755 IO::Pager::Page module is available, the formatted documentation is
756 then paged.
757
758 If standard output is not connected to a terminal or POD::Text is
759 not available, the POD is not formatted.
760
761 --version
762 This argument causes the program to print the version number of the
763 program (as specified in the "=head1 VERSION" section of the POD)
764 and any copyright information (as specified in the "=head1
765 COPYRIGHT" POD section) and then exit.
766
767 Minimalist keys
768 By default, the keys of %ARGV will match the program's interface
769 exactly. That is, if your program accepts the following arguments:
770
771 -v
772 --mode <modename>
773 <infile>
774 <outfile>
775 --auto-fudge
776
777 Then the keys that appear in %ARGV will be:
778
779 '-v'
780 '--mode'
781 '<infile>'
782 '<outfile>'
783 '--auto-fudge'
784
785 In some cases, however, it may be preferable to have Getopt::Euclid set
786 up those hash keys without "decorations". That is, to have the keys of
787 %ARGV be simply:
788
789 'v'
790 'mode'
791 'infile'
792 'outfile'
793 'auto_fudge'
794
795 You can arrange this by loading the module with the special
796 ':minimal_keys' specifier:
797
798 use Getopt::Euclid qw( :minimal_keys );
799
800 Note that, in rare cases, using this mode may cause you to lose data
801 (for example, if the interface specifies both a "--step" and a "<step>"
802 option). The module throws an exception if this happens.
803
805 Compile-time diagnostics
806 The following diagnostics are mainly caused by problems in the POD
807 specification of the command-line interface:
808
809 Getopt::Euclid was unable to access POD
810 Something is horribly wrong. Getopt::Euclid was unable to read your
811 program to extract the POD from it. Check your program's
812 permissions, though it's a mystery how perl was able to run the
813 program in the first place, if it's not readable.
814
815 .pm file cannot define an explicit import() when using Getopt::Euclid
816 You tried to define an "import()" subroutine in a module that was
817 also using Getopt::Euclid. Since the whole point of using
818 Getopt::Euclid in a module is to have it build an "import()" for
819 you, supplying your own "import()" as well defeats the purpose.
820
821 Unknown specification: %s
822 You specified something in a "=for Euclid" section that
823 Getopt::Euclid didn't understand. This is often caused by typos, or
824 by reversing a placeholder.type or placeholder.default
825 specification (that is, writing type.placeholder or
826 default.placeholder instead).
827
828 Unknown type (%s) in specification: %s
829 Unknown .type constraint: %s
830 Both these errors mean that you specified a type constraint that
831 Getopt::Euclid didn't recognize. This may have been a typo:
832
833 =for Euclid
834 count.type: inetger
835
836 or else the module simply doesn't know about the type you
837 specified:
838
839 =for Euclid
840 count.type: complex
841
842 See "Standard placeholder types" for a list of types that
843 Getopt::Euclid does recognize.
844
845 Invalid .type constraint: %s
846 You specified a type constraint that isn't valid Perl. For example:
847
848 =for Euclid
849 max.type: integer not equals 0
850
851 instead of:
852
853 =for Euclid
854 max.type: integer != 0
855
856 Invalid .default value: %s
857 You specified a default value that isn't valid Perl. For example:
858
859 =for Euclid
860 curse.default: *$@!&
861
862 instead of:
863
864 =for Euclid
865 curse.default: '*$@!&'
866
867 Invalid constraint: %s (No <%s> placeholder in argument: %s)
868 You attempted to define a ".type" constraint for a placeholder that
869 didn't exist. Typically this is the result of the misspelling of a
870 placeholder name:
871
872 =item -foo <bar>
873
874 =for Euclid:
875 baz.type: integer
876
877 or a "=for Euclid:" that has drifted away from its argument:
878
879 =item -foo <bar>
880
881 =item -verbose
882
883 =for Euclid:
884 bar.type: integer
885
886 Getopt::Euclid loaded a second time
887 You tried to load the module twice in the same program.
888 Getopt::Euclid doesn't work that way. Load it only once.
889
890 Unknown mode ('%s')
891 The only argument that a "use Getopt::Euclid" command accepts is
892 ':minimal_keys' (see "Minimalist keys"). You specified something
893 else instead (or possibly forgot to put a semicolon after "use
894 Getopt::Euclid").
895
896 Internal error: minimalist mode caused arguments '%s' and '%s' to clash
897 Minimalist mode removes certain characters from the keys hat are
898 returned in %ARGV. This can mean that two command-line options
899 (such as "--step" and "<step>") map to the same key (i.e. 'step').
900 This in turn means that one of the two options has overwritten the
901 other within the %ARGV hash. The program developer should either
902 turn off ':minimal_keys' mode within the program, or else change
903 the name of one of the options so that the two no longer clash.
904
905 Run-time diagnostics
906 The following diagnostics are caused by problems in parsing the
907 command-line
908
909 Missing required argument(s): %s
910 At least one argument specified in the "REQUIRED ARGUMENTS" POD
911 section wasn't present on the command-line.
912
913 Invalid %s argument. %s must be %s but the supplied value (%s) isn't.
914 Getopt::Euclid recognized the argument you were trying to specify
915 on the command-line, but the value you gave to one of that
916 argument's placeholders was of the wrong type.
917
918 Unknown argument: %s
919 Getopt::Euclid didn't recognize an argument you were trying to
920 specify on the command-line. This is often caused by command-line
921 typos or an incomplete interface specification.
922
924 Getopt::Euclid requires no configuration files or environment
925 variables.
926
928 · File::Spec::Functions
929
930 · List::Util
931
933 None reported.
934
936 Please report any bugs or feature requests to
937 "bug-getopt-euclid@rt.cpan.org", or through the web interface at
938 <http://rt.cpan.org>.
939
941 Damian Conway "<DCONWAY@cpan.org>"
942
943 Kevin Galinsky "<kgalinsky+cpan at gmail.com>"
944
946 Copyright (c) 2005, Damian Conway "<DCONWAY@cpan.org>". All rights
947 reserved.
948
949 This module is free software; you can redistribute it and/or modify it
950 under the same terms as Perl itself.
951
953 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
954 FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
955 WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
956 PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
957 EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
958 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
959 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
960 YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
961 NECESSARY SERVICING, REPAIR, OR CORRECTION.
962
963 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
964 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
965 REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
966 TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
967 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
968 SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
969 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
970 FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
971 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
972 DAMAGES.
973
974
975
976perl v5.12.2 2010-12-08 Getopt::Euclid(3)