This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[win32] merge changes#982,984 from maintbranch
[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         *OS_ERROR
69         *ERRNO
70         *EXTENDED_OS_ERROR
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
92         *OSNAME
93 );
94
95 # The ground of all being. @ARG is deprecated (5.005 makes @_ lexical)
96
97         *ARG                                    = *_    ;
98
99 # Matching.
100
101         *MATCH                                  = *&    ;
102         *PREMATCH                               = *`    ;
103         *POSTMATCH                              = *'    ;
104         *LAST_PAREN_MATCH                       = *+    ;
105
106 # Input.
107
108         *INPUT_LINE_NUMBER                      = *.    ;
109             *NR                                 = *.    ;
110         *INPUT_RECORD_SEPARATOR                 = */    ;
111             *RS                                 = */    ;
112
113 # Output.
114
115         *OUTPUT_AUTOFLUSH                       = *|    ;
116         *OUTPUT_FIELD_SEPARATOR                 = *,    ;
117             *OFS                                = *,    ;
118         *OUTPUT_RECORD_SEPARATOR                = *\    ;
119             *ORS                                = *\    ;
120
121 # Interpolation "constants".
122
123         *LIST_SEPARATOR                         = *"    ;
124         *SUBSCRIPT_SEPARATOR                    = *;    ;
125             *SUBSEP                             = *;    ;
126
127 # Formats
128
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   ;
136
137 # Error status.
138
139         *CHILD_ERROR                            = *?    ;
140         *OS_ERROR                               = \$!   ;
141             *ERRNO                              = \$!   ;
142         *EXTENDED_OS_ERROR                      = *^E   ;
143         *EVAL_ERROR                             = *@    ;
144
145 # Process info.
146
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    ;
158
159 # Internals.
160
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   ;
170         *OSNAME                                 = *^O   ;
171
172 # Deprecated.
173
174 #       *ARRAY_BASE                             = *[    ;
175 #       *OFMT                                   = *#    ;
176 #       *MULTILINE_MATCHING                     = **    ;
177
178 1;