File: README

package info (click to toggle)
slice 1.3.8-14
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 872 kB
  • sloc: ansic: 3,310; perl: 2,263; sh: 869; makefile: 296; yacc: 127
file content (186 lines) | stat: -rw-r--r-- 5,798 bytes parent folder | download | duplicates (11)
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
Module Getopt::Long - extended processing of command line options
=================================================================

Module Getopt::Long implements an extended getopt function called
GetOptions(). This function implements the POSIX standard for command
line options, with GNU extensions, while still capable of handling
the traditional one-letter options.
In general, this means that command line options can have long names
instead of single letters, and are introduced with a double dash `--'.

Optionally, Getopt::Long can support the traditional bundling of
single-letter command line options.

Getopt::Long::GetOptions() is part of the Perl 5 distribution. It is
the successor of newgetopt.pl that came with Perl 4. It is fully
upward compatible. In fact, the Perl 5 version of newgetopt.pl is just
a wrapper around the module.

For complete documentation, see the Getopt::Long POD document or use
the command

    perldoc Getopt::Long

FEATURES
========

* Long option names

Major advantage of using long option names is that it is much easier
to memorize the option names. Using single-letter names one quickly
runs into the problem that there is no logical relationship between
the semantics of the selected option and its option letter.
Disadvantage is that it requires more typing. Getopt::Long provides
for option name abbreviation, so option names may be abbreviated to
uniqueness. Also, modern shells like Cornell's tcsh support option
name completion. As a rule of thumb, you can use abbreviations freely
while running commands interactively but always use the full names in
scripts. 

Examples (POSIX):

    --long --width=80 --height=24

Extensions:

    -long (convenience) +width=80 (deprecated) -height 24 (traditional)

By default, long option names are case insensitive.

* Single-letter options and bundling

When single-letter options are requested, Getopt::Long allows the
option names to be bundled, e.g. "-abc" is equivalent to "-a -b -c".
In this case, long option names must be introduced with the POSIX "--"
introducer.

Examples:

    -lgAd (bundle) -xw 80 (bundle, w takes a value) -xw80 (same)
    even -l24w80 (l = 24 and w = 80)

By default, single-letter option names are case sensitive.

* Flexibility:

  - options can have alternative names, using an alternative name
    will behave as if the primary name was used;
  - options can be negatable, e.g. "debug" will switch it on, while
    "nodebug" will switch it off.    
  - options can set values, but also add values producing an array
    of values instead of a single scalar value, or set values in a hash.

* Options linkage

Using Getopt::Long gives the programmer ultimate control over the
command line options and how they must be handled:

  - by setting a global variable in the calling program;
  - by setting a specified variable;
  - by entering the option name and the value in an associative array
    (hash) or object (if it is a blessed hash);
  - by calling a user-specified subroutine with the option name and
    the value as arguments;
  - combinations of the above.

* Customization:

The module contains a special method, Getopt::Long::Configure, to
control configuration variables to activate (or de-activate) specific
behavior. It can be called with one or more names of options:

  - default

	Restore default settings.

  - auto_abbrev      

	Allow option names to be abbreviated to uniqueness. 

  - getopt_compat   

	Allow '+' to start options.

  - permute
  - require_order           

	Whether non-options are allowed to be mixed with options.

	permute means that 

	    -foo arg1 -bar arg2 arg3

	is equivalent to

	    -foo -bar arg1 arg2 arg3

	(provided -foo does not take an argument value).

	require_order means that options processing
	terminates when the first non-option is encountered.

	    -foo arg1 -bar arg2 arg3

	is equivalent to

	    -foo -- arg1 -bar arg2 arg3

  - bundling

	Setting this variable to a non-zero value will allow 
	single-character options to be bundled. To distinguish bundles
	from long option names, long options must be introduced with 
	"--" and single-character options (and bundles) with "-".

  - ignore_case      

	Ignore case when matching options.

  - pass_through

	Do not issue error messages for unknown options, but leave
	them (pass-through) in @ARGV.

  - prefix

	The string that starts options. See also prefix_pattern.

  - prefix_pattern

	A Perl pattern that identifies the strings that introduce
	options. Default is (--|-|\+) unless environment variable
	POSIXLY_CORRECT has been set, in which case it is (--|-).

* Usable variables

  - $Getopt::Long::error

	Internal error flag. May be incremented from a call-back
	routine to cause options parsing to fail.

  - $Getopt::Long::debug           

	Enable copious debugging output. Default is 0.

AVAILABILITY
============

The official version for module Getopt::Long comes with the Perl 5
distribution. 
Newer versions will be made available on the Comprehensive Perl Archive
Network (CPAN), see "http://www.perl.com/CPAN/authors/Johan_Vromans".

COPYRIGHT AND DISCLAIMER
========================

Module Getopt::Long is Copyright 1990,1999 by Johan Vromans.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

-------------------------------------------------------------------
Johan Vromans                                  jvromans@squirrel.nl
Squirrel Consultancy                       Haarlem, the Netherlands
http://www.squirrel.nl       http://www.squirrel.nl/people/jvromans
------------------ "Arms are made for hugging" --------------------