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 | |
30 | =cut |
31 | |
748a9306 |
32 | local $^W = 0; |
33 | |
34 | # Grandfather $NAME import |
35 | sub import { |
36 | my $this = shift; |
37 | my @list = @_; |
38 | local $Exporter::ExportLevel = 1; |
39 | Exporter::import($this,grep {s/^\$/*/} @list); |
40 | } |
a0d0e21e |
41 | |
8990e307 |
42 | @EXPORT = qw( |
43 | *ARG |
748a9306 |
44 | *MATCH |
45 | *PREMATCH |
46 | *POSTMATCH |
47 | *LAST_PAREN_MATCH |
48 | *INPUT_LINE_NUMBER |
49 | *NR |
50 | *INPUT_RECORD_SEPARATOR |
51 | *RS |
52 | *OUTPUT_AUTOFLUSH |
53 | *OUTPUT_FIELD_SEPARATOR |
54 | *OFS |
55 | *OUTPUT_RECORD_SEPARATOR |
56 | *ORS |
57 | *LIST_SEPARATOR |
58 | *SUBSCRIPT_SEPARATOR |
59 | *SUBSEP |
60 | *FORMAT_PAGE_NUMBER |
61 | *FORMAT_LINES_PER_PAGE |
62 | *FORMAT_LINES_LEFT |
63 | *FORMAT_NAME |
64 | *FORMAT_TOP_NAME |
65 | *FORMAT_LINE_BREAK_CHARACTERS |
66 | *FORMAT_FORMFEED |
67 | *CHILD_ERROR |
68 | *OS_ERROR |
69 | *ERRNO |
d57fa8b6 |
70 | *EXTENDED_OS_ERROR |
748a9306 |
71 | *EVAL_ERROR |
72 | *PROCESS_ID |
73 | *PID |
74 | *REAL_USER_ID |
75 | *UID |
76 | *EFFECTIVE_USER_ID |
77 | *EUID |
78 | *REAL_GROUP_ID |
79 | *GID |
80 | *EFFECTIVE_GROUP_ID |
81 | *EGID |
82 | *PROGRAM_NAME |
83 | *PERL_VERSION |
84 | *ACCUMULATOR |
85 | *DEBUGGING |
86 | *SYSTEM_FD_MAX |
87 | *INPLACE_EDIT |
88 | *PERLDB |
89 | *BASETIME |
90 | *WARNING |
91 | *EXECUTABLE_NAME |
d57fa8b6 |
92 | *OSNAME |
8990e307 |
93 | ); |
94 | |
fb73857a |
95 | # The ground of all being. @ARG is deprecated (5.005 makes @_ lexical) |
8990e307 |
96 | |
8990e307 |
97 | *ARG = *_ ; |
98 | |
99 | # Matching. |
100 | |
748a9306 |
101 | *MATCH = *& ; |
102 | *PREMATCH = *` ; |
103 | *POSTMATCH = *' ; |
104 | *LAST_PAREN_MATCH = *+ ; |
8990e307 |
105 | |
106 | # Input. |
107 | |
748a9306 |
108 | *INPUT_LINE_NUMBER = *. ; |
109 | *NR = *. ; |
110 | *INPUT_RECORD_SEPARATOR = */ ; |
111 | *RS = */ ; |
8990e307 |
112 | |
113 | # Output. |
114 | |
748a9306 |
115 | *OUTPUT_AUTOFLUSH = *| ; |
116 | *OUTPUT_FIELD_SEPARATOR = *, ; |
117 | *OFS = *, ; |
118 | *OUTPUT_RECORD_SEPARATOR = *\ ; |
119 | *ORS = *\ ; |
8990e307 |
120 | |
121 | # Interpolation "constants". |
122 | |
748a9306 |
123 | *LIST_SEPARATOR = *" ; |
124 | *SUBSCRIPT_SEPARATOR = *; ; |
125 | *SUBSEP = *; ; |
8990e307 |
126 | |
127 | # Formats |
128 | |
748a9306 |
129 | *FORMAT_PAGE_NUMBER = *% ; |
130 | *FORMAT_LINES_PER_PAGE = *= ; |
131 | *FORMAT_LINES_LEFT = *- ; |
132 | *FORMAT_NAME = *~ ; |
133 | *FORMAT_TOP_NAME = *^ ; |
134 | *FORMAT_LINE_BREAK_CHARACTERS = *: ; |
135 | *FORMAT_FORMFEED = *^L ; |
8990e307 |
136 | |
137 | # Error status. |
138 | |
748a9306 |
139 | *CHILD_ERROR = *? ; |
140 | *OS_ERROR = *! ; |
141 | *ERRNO = *! ; |
f86702cc |
142 | *EXTENDED_OS_ERROR = *^E ; |
748a9306 |
143 | *EVAL_ERROR = *@ ; |
8990e307 |
144 | |
145 | # Process info. |
146 | |
748a9306 |
147 | *PROCESS_ID = *$ ; |
148 | *PID = *$ ; |
149 | *REAL_USER_ID = *< ; |
150 | *UID = *< ; |
151 | *EFFECTIVE_USER_ID = *> ; |
152 | *EUID = *> ; |
153 | *REAL_GROUP_ID = *( ; |
154 | *GID = *( ; |
155 | *EFFECTIVE_GROUP_ID = *) ; |
156 | *EGID = *) ; |
157 | *PROGRAM_NAME = *0 ; |
8990e307 |
158 | |
159 | # Internals. |
160 | |
748a9306 |
161 | *PERL_VERSION = *] ; |
162 | *ACCUMULATOR = *^A ; |
163 | *DEBUGGING = *^D ; |
164 | *SYSTEM_FD_MAX = *^F ; |
165 | *INPLACE_EDIT = *^I ; |
166 | *PERLDB = *^P ; |
167 | *BASETIME = *^T ; |
168 | *WARNING = *^W ; |
169 | *EXECUTABLE_NAME = *^X ; |
d57fa8b6 |
170 | *OSNAME = *^O ; |
8990e307 |
171 | |
172 | # Deprecated. |
173 | |
748a9306 |
174 | # *ARRAY_BASE = *[ ; |
175 | # *OFMT = *# ; |
176 | # *MULTILINE_MATCHING = ** ; |
8990e307 |
177 | |
178 | 1; |