This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
9ed4fc859719c4cd1e960dcfa0a3f6f9014676ae
[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 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
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
40 no warnings;
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 }
49
50 @EXPORT = qw(
51         *ARG
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
78         *EXTENDED_OS_ERROR
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
100         *OSNAME
101 );
102
103 # The ground of all being. @ARG is deprecated (5.005 makes @_ lexical)
104
105         *ARG                                    = *_    ;
106
107 # Matching.
108
109         *MATCH                                  = *&    ;
110         *PREMATCH                               = *`    ;
111         *POSTMATCH                              = *'    ;
112         *LAST_PAREN_MATCH                       = *+    ;
113
114 # Input.
115
116         *INPUT_LINE_NUMBER                      = *.    ;
117             *NR                                 = *.    ;
118         *INPUT_RECORD_SEPARATOR                 = */    ;
119             *RS                                 = */    ;
120
121 # Output.
122
123         *OUTPUT_AUTOFLUSH                       = *|    ;
124         *OUTPUT_FIELD_SEPARATOR                 = *,    ;
125             *OFS                                = *,    ;
126         *OUTPUT_RECORD_SEPARATOR                = *\    ;
127             *ORS                                = *\    ;
128
129 # Interpolation "constants".
130
131         *LIST_SEPARATOR                         = *"    ;
132         *SUBSCRIPT_SEPARATOR                    = *;    ;
133             *SUBSEP                             = *;    ;
134
135 # Formats
136
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   ;
144
145 # Error status.
146
147         *CHILD_ERROR                            = *?    ;
148         *OS_ERROR                               = *!    ;
149             *ERRNO                              = *!    ;
150         *EXTENDED_OS_ERROR                      = *^E   ;
151         *EVAL_ERROR                             = *@    ;
152
153 # Process info.
154
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    ;
166
167 # Internals.
168
169         *PERL_VERSION                           = *]    ;
170         *ACCUMULATOR                            = *^A   ;
171         *COMPILING                              = *^C   ;
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   ;
179         *OSNAME                                 = *^O   ;
180
181 # Deprecated.
182
183 #       *ARRAY_BASE                             = *[    ;
184 #       *OFMT                                   = *#    ;
185 #       *MULTILINE_MATCHING                     = **    ;
186
187 1;