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