Commit | Line | Data |
8990e307 |
1 | package English; |
2 | |
3 | require Exporter; |
4 | @ISA = (Exporter); |
5 | |
f06db76b |
6 | =head1 NAME |
7 | |
8 | English - use nice English (or awk) names for ugly punctuation variables |
9 | |
10 | =head1 SYNOPSIS |
11 | |
12 | use English; |
13 | ... |
14 | if ($ERRNO =~ /denied/) { ... } |
15 | |
16 | =head1 DESCRIPTION |
17 | |
18 | This module provides aliases for the built-in variables whose |
19 | names no one seems to like to read. Variables with side-effects |
20 | which get triggered just by accessing them (like $0) will still |
21 | be affected. |
22 | |
23 | For those variables that have an B<awk> version, both long |
24 | and short English alternatives are provided. For example, |
25 | the C<$/> variable can be referred to either $RS or |
26 | $INPUT_RECORD_SEPARATOR if you are using the English module. |
27 | |
28 | See L<perlvar> for a complete list of these. |
29 | |
f2545c07 |
30 | =head1 BUGS |
31 | |
32 | This module provokes sizeable inefficiencies for regular expressions, |
33 | due to unfortunate implementation details. If performance matters, |
34 | consider avoiding English. |
35 | |
f06db76b |
36 | =cut |
37 | |
db376a24 |
38 | no warnings; |
748a9306 |
39 | |
40 | # Grandfather $NAME import |
41 | sub import { |
42 | my $this = shift; |
43 | my @list = @_; |
44 | local $Exporter::ExportLevel = 1; |
45 | Exporter::import($this,grep {s/^\$/*/} @list); |
46 | } |
a0d0e21e |
47 | |
8990e307 |
48 | @EXPORT = qw( |
49 | *ARG |
748a9306 |
50 | *MATCH |
51 | *PREMATCH |
52 | *POSTMATCH |
53 | *LAST_PAREN_MATCH |
54 | *INPUT_LINE_NUMBER |
55 | *NR |
56 | *INPUT_RECORD_SEPARATOR |
57 | *RS |
58 | *OUTPUT_AUTOFLUSH |
59 | *OUTPUT_FIELD_SEPARATOR |
60 | *OFS |
61 | *OUTPUT_RECORD_SEPARATOR |
62 | *ORS |
63 | *LIST_SEPARATOR |
64 | *SUBSCRIPT_SEPARATOR |
65 | *SUBSEP |
66 | *FORMAT_PAGE_NUMBER |
67 | *FORMAT_LINES_PER_PAGE |
68 | *FORMAT_LINES_LEFT |
69 | *FORMAT_NAME |
70 | *FORMAT_TOP_NAME |
71 | *FORMAT_LINE_BREAK_CHARACTERS |
72 | *FORMAT_FORMFEED |
73 | *CHILD_ERROR |
74 | *OS_ERROR |
75 | *ERRNO |
d57fa8b6 |
76 | *EXTENDED_OS_ERROR |
748a9306 |
77 | *EVAL_ERROR |
78 | *PROCESS_ID |
79 | *PID |
80 | *REAL_USER_ID |
81 | *UID |
82 | *EFFECTIVE_USER_ID |
83 | *EUID |
84 | *REAL_GROUP_ID |
85 | *GID |
86 | *EFFECTIVE_GROUP_ID |
87 | *EGID |
88 | *PROGRAM_NAME |
89 | *PERL_VERSION |
b459063d |
90 | *PERL_VERSION_TUPLE |
748a9306 |
91 | *ACCUMULATOR |
92 | *DEBUGGING |
93 | *SYSTEM_FD_MAX |
94 | *INPLACE_EDIT |
95 | *PERLDB |
96 | *BASETIME |
97 | *WARNING |
98 | *EXECUTABLE_NAME |
d57fa8b6 |
99 | *OSNAME |
66558a10 |
100 | *LAST_REGEXP_CODE_RESULT |
101 | *EXCEPTIONS_BEING_CAUGHT |
8990e307 |
102 | ); |
103 | |
fb73857a |
104 | # The ground of all being. @ARG is deprecated (5.005 makes @_ lexical) |
8990e307 |
105 | |
8990e307 |
106 | *ARG = *_ ; |
107 | |
108 | # Matching. |
109 | |
748a9306 |
110 | *MATCH = *& ; |
111 | *PREMATCH = *` ; |
112 | *POSTMATCH = *' ; |
113 | *LAST_PAREN_MATCH = *+ ; |
8990e307 |
114 | |
115 | # Input. |
116 | |
748a9306 |
117 | *INPUT_LINE_NUMBER = *. ; |
118 | *NR = *. ; |
119 | *INPUT_RECORD_SEPARATOR = */ ; |
120 | *RS = */ ; |
8990e307 |
121 | |
122 | # Output. |
123 | |
748a9306 |
124 | *OUTPUT_AUTOFLUSH = *| ; |
125 | *OUTPUT_FIELD_SEPARATOR = *, ; |
126 | *OFS = *, ; |
127 | *OUTPUT_RECORD_SEPARATOR = *\ ; |
128 | *ORS = *\ ; |
8990e307 |
129 | |
130 | # Interpolation "constants". |
131 | |
748a9306 |
132 | *LIST_SEPARATOR = *" ; |
133 | *SUBSCRIPT_SEPARATOR = *; ; |
134 | *SUBSEP = *; ; |
8990e307 |
135 | |
136 | # Formats |
137 | |
748a9306 |
138 | *FORMAT_PAGE_NUMBER = *% ; |
139 | *FORMAT_LINES_PER_PAGE = *= ; |
140 | *FORMAT_LINES_LEFT = *- ; |
141 | *FORMAT_NAME = *~ ; |
142 | *FORMAT_TOP_NAME = *^ ; |
143 | *FORMAT_LINE_BREAK_CHARACTERS = *: ; |
144 | *FORMAT_FORMFEED = *^L ; |
8990e307 |
145 | |
146 | # Error status. |
147 | |
748a9306 |
148 | *CHILD_ERROR = *? ; |
4318d5a0 |
149 | *OS_ERROR = *! ; |
150 | *ERRNO = *! ; |
f86702cc |
151 | *EXTENDED_OS_ERROR = *^E ; |
748a9306 |
152 | *EVAL_ERROR = *@ ; |
8990e307 |
153 | |
154 | # Process info. |
155 | |
748a9306 |
156 | *PROCESS_ID = *$ ; |
157 | *PID = *$ ; |
158 | *REAL_USER_ID = *< ; |
159 | *UID = *< ; |
160 | *EFFECTIVE_USER_ID = *> ; |
161 | *EUID = *> ; |
162 | *REAL_GROUP_ID = *( ; |
163 | *GID = *( ; |
164 | *EFFECTIVE_GROUP_ID = *) ; |
165 | *EGID = *) ; |
166 | *PROGRAM_NAME = *0 ; |
8990e307 |
167 | |
168 | # Internals. |
169 | |
748a9306 |
170 | *PERL_VERSION = *] ; |
b459063d |
171 | *PERL_VERSION_TUPLE = *^V ; |
748a9306 |
172 | *ACCUMULATOR = *^A ; |
305aace0 |
173 | *COMPILING = *^C ; |
748a9306 |
174 | *DEBUGGING = *^D ; |
175 | *SYSTEM_FD_MAX = *^F ; |
176 | *INPLACE_EDIT = *^I ; |
177 | *PERLDB = *^P ; |
66558a10 |
178 | *LAST_REGEXP_CODE_RESULT = *^R ; |
179 | *EXCEPTIONS_BEING_CAUGHT = *^S ; |
748a9306 |
180 | *BASETIME = *^T ; |
181 | *WARNING = *^W ; |
182 | *EXECUTABLE_NAME = *^X ; |
d57fa8b6 |
183 | *OSNAME = *^O ; |
8990e307 |
184 | |
185 | # Deprecated. |
186 | |
748a9306 |
187 | # *ARRAY_BASE = *[ ; |
188 | # *OFMT = *# ; |
189 | # *MULTILINE_MATCHING = ** ; |
8990e307 |
190 | |
191 | 1; |