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 |
70 | *EVAL_ERROR |
71 | *PROCESS_ID |
72 | *PID |
73 | *REAL_USER_ID |
74 | *UID |
75 | *EFFECTIVE_USER_ID |
76 | *EUID |
77 | *REAL_GROUP_ID |
78 | *GID |
79 | *EFFECTIVE_GROUP_ID |
80 | *EGID |
81 | *PROGRAM_NAME |
82 | *PERL_VERSION |
83 | *ACCUMULATOR |
84 | *DEBUGGING |
85 | *SYSTEM_FD_MAX |
86 | *INPLACE_EDIT |
87 | *PERLDB |
88 | *BASETIME |
89 | *WARNING |
90 | *EXECUTABLE_NAME |
8990e307 |
91 | ); |
92 | |
93 | # The ground of all being. |
94 | |
8990e307 |
95 | *ARG = *_ ; |
96 | |
97 | # Matching. |
98 | |
748a9306 |
99 | *MATCH = *& ; |
100 | *PREMATCH = *` ; |
101 | *POSTMATCH = *' ; |
102 | *LAST_PAREN_MATCH = *+ ; |
8990e307 |
103 | |
104 | # Input. |
105 | |
748a9306 |
106 | *INPUT_LINE_NUMBER = *. ; |
107 | *NR = *. ; |
108 | *INPUT_RECORD_SEPARATOR = */ ; |
109 | *RS = */ ; |
8990e307 |
110 | |
111 | # Output. |
112 | |
748a9306 |
113 | *OUTPUT_AUTOFLUSH = *| ; |
114 | *OUTPUT_FIELD_SEPARATOR = *, ; |
115 | *OFS = *, ; |
116 | *OUTPUT_RECORD_SEPARATOR = *\ ; |
117 | *ORS = *\ ; |
8990e307 |
118 | |
119 | # Interpolation "constants". |
120 | |
748a9306 |
121 | *LIST_SEPARATOR = *" ; |
122 | *SUBSCRIPT_SEPARATOR = *; ; |
123 | *SUBSEP = *; ; |
8990e307 |
124 | |
125 | # Formats |
126 | |
748a9306 |
127 | *FORMAT_PAGE_NUMBER = *% ; |
128 | *FORMAT_LINES_PER_PAGE = *= ; |
129 | *FORMAT_LINES_LEFT = *- ; |
130 | *FORMAT_NAME = *~ ; |
131 | *FORMAT_TOP_NAME = *^ ; |
132 | *FORMAT_LINE_BREAK_CHARACTERS = *: ; |
133 | *FORMAT_FORMFEED = *^L ; |
8990e307 |
134 | |
135 | # Error status. |
136 | |
748a9306 |
137 | *CHILD_ERROR = *? ; |
138 | *OS_ERROR = *! ; |
139 | *ERRNO = *! ; |
140 | *EVAL_ERROR = *@ ; |
8990e307 |
141 | |
142 | # Process info. |
143 | |
748a9306 |
144 | *PROCESS_ID = *$ ; |
145 | *PID = *$ ; |
146 | *REAL_USER_ID = *< ; |
147 | *UID = *< ; |
148 | *EFFECTIVE_USER_ID = *> ; |
149 | *EUID = *> ; |
150 | *REAL_GROUP_ID = *( ; |
151 | *GID = *( ; |
152 | *EFFECTIVE_GROUP_ID = *) ; |
153 | *EGID = *) ; |
154 | *PROGRAM_NAME = *0 ; |
8990e307 |
155 | |
156 | # Internals. |
157 | |
748a9306 |
158 | *PERL_VERSION = *] ; |
159 | *ACCUMULATOR = *^A ; |
160 | *DEBUGGING = *^D ; |
161 | *SYSTEM_FD_MAX = *^F ; |
162 | *INPLACE_EDIT = *^I ; |
163 | *PERLDB = *^P ; |
164 | *BASETIME = *^T ; |
165 | *WARNING = *^W ; |
166 | *EXECUTABLE_NAME = *^X ; |
8990e307 |
167 | |
168 | # Deprecated. |
169 | |
748a9306 |
170 | # *ARRAY_BASE = *[ ; |
171 | # *OFMT = *# ; |
172 | # *MULTILINE_MATCHING = ** ; |
8990e307 |
173 | |
174 | 1; |