This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[inseparable changes from patch from perl5.003_24 to perl5.003_25]
[perl5.git] / lib / English.pm
1 package English;
2
3 require Exporter;
4 @ISA = (Exporter);
5
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
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 }
41
42 @EXPORT = qw(
43         *ARG
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         *SYSTEM_CHILD_STATUS
69         *OS_ERROR
70         *ERRNO
71         *EXTENDED_OS_ERROR
72         *EVAL_ERROR
73         *PROCESS_ID
74         *PID
75         *REAL_USER_ID
76         *UID
77         *EFFECTIVE_USER_ID
78         *EUID
79         *REAL_GROUP_ID
80         *GID
81         *EFFECTIVE_GROUP_ID
82         *EGID
83         *PROGRAM_NAME
84         *PERL_VERSION
85         *ACCUMULATOR
86         *DEBUGGING
87         *SYSTEM_FD_MAX
88         *INPLACE_EDIT
89         *PERLDB
90         *BASETIME
91         *WARNING
92         *EXECUTABLE_NAME
93         *OSNAME
94 );
95
96 # The ground of all being.
97
98         *ARG                                    = *_    ;
99
100 # Matching.
101
102         *MATCH                                  = *&    ;
103         *PREMATCH                               = *`    ;
104         *POSTMATCH                              = *'    ;
105         *LAST_PAREN_MATCH                       = *+    ;
106
107 # Input.
108
109         *INPUT_LINE_NUMBER                      = *.    ;
110             *NR                                 = *.    ;
111         *INPUT_RECORD_SEPARATOR                 = */    ;
112             *RS                                 = */    ;
113
114 # Output.
115
116         *OUTPUT_AUTOFLUSH                       = *|    ;
117         *OUTPUT_FIELD_SEPARATOR                 = *,    ;
118             *OFS                                = *,    ;
119         *OUTPUT_RECORD_SEPARATOR                = *\    ;
120             *ORS                                = *\    ;
121
122 # Interpolation "constants".
123
124         *LIST_SEPARATOR                         = *"    ;
125         *SUBSCRIPT_SEPARATOR                    = *;    ;
126             *SUBSEP                             = *;    ;
127
128 # Formats
129
130         *FORMAT_PAGE_NUMBER                     = *%    ;
131         *FORMAT_LINES_PER_PAGE                  = *=    ;
132         *FORMAT_LINES_LEFT                      = *-    ;
133         *FORMAT_NAME                            = *~    ;
134         *FORMAT_TOP_NAME                        = *^    ;
135         *FORMAT_LINE_BREAK_CHARACTERS           = *:    ;
136         *FORMAT_FORMFEED                        = *^L   ;
137
138 # Error status.
139
140         *CHILD_ERROR                            = *?    ;
141         *SYSTEM_CHILD_STATUS                    = *^S   ;
142         *OS_ERROR                               = *!    ;
143             *ERRNO                              = *!    ;
144         *EXTENDED_OS_ERROR                      = *^E   ;
145         *EVAL_ERROR                             = *@    ;
146
147 # Process info.
148
149         *PROCESS_ID                             = *$    ;
150             *PID                                = *$    ;
151         *REAL_USER_ID                           = *<    ;
152             *UID                                = *<    ;
153         *EFFECTIVE_USER_ID                      = *>    ;
154             *EUID                               = *>    ;
155         *REAL_GROUP_ID                          = *(    ;
156             *GID                                = *(    ;
157         *EFFECTIVE_GROUP_ID                     = *)    ;
158             *EGID                               = *)    ;
159         *PROGRAM_NAME                           = *0    ;
160
161 # Internals.
162
163         *PERL_VERSION                           = *]    ;
164         *ACCUMULATOR                            = *^A   ;
165         *DEBUGGING                              = *^D   ;
166         *SYSTEM_FD_MAX                          = *^F   ;
167         *INPLACE_EDIT                           = *^I   ;
168         *PERLDB                                 = *^P   ;
169         *BASETIME                               = *^T   ;
170         *WARNING                                = *^W   ;
171         *EXECUTABLE_NAME                        = *^X   ;
172         *OSNAME                                 = *^O   ;
173
174 # Deprecated.
175
176 #       *ARRAY_BASE                             = *[    ;
177 #       *OFMT                                   = *#    ;
178 #       *MULTILINE_MATCHING                     = **    ;
179
180 1;