1*0Sstevel@tonic-gatepackage English; 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateour $VERSION = '1.01'; 4*0Sstevel@tonic-gate 5*0Sstevel@tonic-gaterequire Exporter; 6*0Sstevel@tonic-gate@ISA = (Exporter); 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gate=head1 NAME 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gateEnglish - use nice English (or awk) names for ugly punctuation variables 11*0Sstevel@tonic-gate 12*0Sstevel@tonic-gate=head1 SYNOPSIS 13*0Sstevel@tonic-gate 14*0Sstevel@tonic-gate use English qw( -no_match_vars ) ; # Avoids regex performance penalty 15*0Sstevel@tonic-gate use English; 16*0Sstevel@tonic-gate ... 17*0Sstevel@tonic-gate if ($ERRNO =~ /denied/) { ... } 18*0Sstevel@tonic-gate 19*0Sstevel@tonic-gate=head1 DESCRIPTION 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gateThis module provides aliases for the built-in variables whose 22*0Sstevel@tonic-gatenames no one seems to like to read. Variables with side-effects 23*0Sstevel@tonic-gatewhich get triggered just by accessing them (like $0) will still 24*0Sstevel@tonic-gatebe affected. 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gateFor those variables that have an B<awk> version, both long 27*0Sstevel@tonic-gateand short English alternatives are provided. For example, 28*0Sstevel@tonic-gatethe C<$/> variable can be referred to either $RS or 29*0Sstevel@tonic-gate$INPUT_RECORD_SEPARATOR if you are using the English module. 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gateSee L<perlvar> for a complete list of these. 32*0Sstevel@tonic-gate 33*0Sstevel@tonic-gate=head1 PERFORMANCE 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gateThis module can provoke sizeable inefficiencies for regular expressions, 36*0Sstevel@tonic-gatedue to unfortunate implementation details. If performance matters in 37*0Sstevel@tonic-gateyour application and you don't need $PREMATCH, $MATCH, or $POSTMATCH, 38*0Sstevel@tonic-gatetry doing 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate use English qw( -no_match_vars ) ; 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate. B<It is especially important to do this in modules to avoid penalizing 43*0Sstevel@tonic-gateall applications which use them.> 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate=cut 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gateno warnings; 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gatemy $globbed_match ; 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate# Grandfather $NAME import 52*0Sstevel@tonic-gatesub import { 53*0Sstevel@tonic-gate my $this = shift; 54*0Sstevel@tonic-gate my @list = grep { ! /^-no_match_vars$/ } @_ ; 55*0Sstevel@tonic-gate local $Exporter::ExportLevel = 1; 56*0Sstevel@tonic-gate if ( @_ == @list ) { 57*0Sstevel@tonic-gate *EXPORT = \@COMPLETE_EXPORT ; 58*0Sstevel@tonic-gate $globbed_match ||= ( 59*0Sstevel@tonic-gate eval q{ 60*0Sstevel@tonic-gate *MATCH = *& ; 61*0Sstevel@tonic-gate *PREMATCH = *` ; 62*0Sstevel@tonic-gate *POSTMATCH = *' ; 63*0Sstevel@tonic-gate 1 ; 64*0Sstevel@tonic-gate } 65*0Sstevel@tonic-gate || do { 66*0Sstevel@tonic-gate require Carp ; 67*0Sstevel@tonic-gate Carp::croak "Can't create English for match leftovers: $@" ; 68*0Sstevel@tonic-gate } 69*0Sstevel@tonic-gate ) ; 70*0Sstevel@tonic-gate } 71*0Sstevel@tonic-gate else { 72*0Sstevel@tonic-gate *EXPORT = \@MINIMAL_EXPORT ; 73*0Sstevel@tonic-gate } 74*0Sstevel@tonic-gate Exporter::import($this,grep {s/^\$/*/} @list); 75*0Sstevel@tonic-gate} 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate@MINIMAL_EXPORT = qw( 78*0Sstevel@tonic-gate *ARG 79*0Sstevel@tonic-gate *LAST_PAREN_MATCH 80*0Sstevel@tonic-gate *INPUT_LINE_NUMBER 81*0Sstevel@tonic-gate *NR 82*0Sstevel@tonic-gate *INPUT_RECORD_SEPARATOR 83*0Sstevel@tonic-gate *RS 84*0Sstevel@tonic-gate *OUTPUT_AUTOFLUSH 85*0Sstevel@tonic-gate *OUTPUT_FIELD_SEPARATOR 86*0Sstevel@tonic-gate *OFS 87*0Sstevel@tonic-gate *OUTPUT_RECORD_SEPARATOR 88*0Sstevel@tonic-gate *ORS 89*0Sstevel@tonic-gate *LIST_SEPARATOR 90*0Sstevel@tonic-gate *SUBSCRIPT_SEPARATOR 91*0Sstevel@tonic-gate *SUBSEP 92*0Sstevel@tonic-gate *FORMAT_PAGE_NUMBER 93*0Sstevel@tonic-gate *FORMAT_LINES_PER_PAGE 94*0Sstevel@tonic-gate *FORMAT_LINES_LEFT 95*0Sstevel@tonic-gate *FORMAT_NAME 96*0Sstevel@tonic-gate *FORMAT_TOP_NAME 97*0Sstevel@tonic-gate *FORMAT_LINE_BREAK_CHARACTERS 98*0Sstevel@tonic-gate *FORMAT_FORMFEED 99*0Sstevel@tonic-gate *CHILD_ERROR 100*0Sstevel@tonic-gate *OS_ERROR 101*0Sstevel@tonic-gate *ERRNO 102*0Sstevel@tonic-gate *EXTENDED_OS_ERROR 103*0Sstevel@tonic-gate *EVAL_ERROR 104*0Sstevel@tonic-gate *PROCESS_ID 105*0Sstevel@tonic-gate *PID 106*0Sstevel@tonic-gate *REAL_USER_ID 107*0Sstevel@tonic-gate *UID 108*0Sstevel@tonic-gate *EFFECTIVE_USER_ID 109*0Sstevel@tonic-gate *EUID 110*0Sstevel@tonic-gate *REAL_GROUP_ID 111*0Sstevel@tonic-gate *GID 112*0Sstevel@tonic-gate *EFFECTIVE_GROUP_ID 113*0Sstevel@tonic-gate *EGID 114*0Sstevel@tonic-gate *PROGRAM_NAME 115*0Sstevel@tonic-gate *PERL_VERSION 116*0Sstevel@tonic-gate *ACCUMULATOR 117*0Sstevel@tonic-gate *DEBUGGING 118*0Sstevel@tonic-gate *SYSTEM_FD_MAX 119*0Sstevel@tonic-gate *INPLACE_EDIT 120*0Sstevel@tonic-gate *PERLDB 121*0Sstevel@tonic-gate *BASETIME 122*0Sstevel@tonic-gate *WARNING 123*0Sstevel@tonic-gate *EXECUTABLE_NAME 124*0Sstevel@tonic-gate *OSNAME 125*0Sstevel@tonic-gate *LAST_REGEXP_CODE_RESULT 126*0Sstevel@tonic-gate *EXCEPTIONS_BEING_CAUGHT 127*0Sstevel@tonic-gate *LAST_SUBMATCH_RESULT 128*0Sstevel@tonic-gate @LAST_MATCH_START 129*0Sstevel@tonic-gate @LAST_MATCH_END 130*0Sstevel@tonic-gate); 131*0Sstevel@tonic-gate 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gate@MATCH_EXPORT = qw( 134*0Sstevel@tonic-gate *MATCH 135*0Sstevel@tonic-gate *PREMATCH 136*0Sstevel@tonic-gate *POSTMATCH 137*0Sstevel@tonic-gate); 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate@COMPLETE_EXPORT = ( @MINIMAL_EXPORT, @MATCH_EXPORT ) ; 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate# The ground of all being. @ARG is deprecated (5.005 makes @_ lexical) 142*0Sstevel@tonic-gate 143*0Sstevel@tonic-gate *ARG = *_ ; 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate# Matching. 146*0Sstevel@tonic-gate 147*0Sstevel@tonic-gate *LAST_PAREN_MATCH = *+ ; 148*0Sstevel@tonic-gate *LAST_SUBMATCH_RESULT = *^N ; 149*0Sstevel@tonic-gate *LAST_MATCH_START = *-{ARRAY} ; 150*0Sstevel@tonic-gate *LAST_MATCH_END = *+{ARRAY} ; 151*0Sstevel@tonic-gate 152*0Sstevel@tonic-gate# Input. 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate *INPUT_LINE_NUMBER = *. ; 155*0Sstevel@tonic-gate *NR = *. ; 156*0Sstevel@tonic-gate *INPUT_RECORD_SEPARATOR = */ ; 157*0Sstevel@tonic-gate *RS = */ ; 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate# Output. 160*0Sstevel@tonic-gate 161*0Sstevel@tonic-gate *OUTPUT_AUTOFLUSH = *| ; 162*0Sstevel@tonic-gate *OUTPUT_FIELD_SEPARATOR = *, ; 163*0Sstevel@tonic-gate *OFS = *, ; 164*0Sstevel@tonic-gate *OUTPUT_RECORD_SEPARATOR = *\ ; 165*0Sstevel@tonic-gate *ORS = *\ ; 166*0Sstevel@tonic-gate 167*0Sstevel@tonic-gate# Interpolation "constants". 168*0Sstevel@tonic-gate 169*0Sstevel@tonic-gate *LIST_SEPARATOR = *" ; 170*0Sstevel@tonic-gate *SUBSCRIPT_SEPARATOR = *; ; 171*0Sstevel@tonic-gate *SUBSEP = *; ; 172*0Sstevel@tonic-gate 173*0Sstevel@tonic-gate# Formats 174*0Sstevel@tonic-gate 175*0Sstevel@tonic-gate *FORMAT_PAGE_NUMBER = *% ; 176*0Sstevel@tonic-gate *FORMAT_LINES_PER_PAGE = *= ; 177*0Sstevel@tonic-gate *FORMAT_LINES_LEFT = *- ; 178*0Sstevel@tonic-gate *FORMAT_NAME = *~ ; 179*0Sstevel@tonic-gate *FORMAT_TOP_NAME = *^ ; 180*0Sstevel@tonic-gate *FORMAT_LINE_BREAK_CHARACTERS = *: ; 181*0Sstevel@tonic-gate *FORMAT_FORMFEED = *^L ; 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate# Error status. 184*0Sstevel@tonic-gate 185*0Sstevel@tonic-gate *CHILD_ERROR = *? ; 186*0Sstevel@tonic-gate *OS_ERROR = *! ; 187*0Sstevel@tonic-gate *ERRNO = *! ; 188*0Sstevel@tonic-gate *OS_ERROR = *! ; 189*0Sstevel@tonic-gate *ERRNO = *! ; 190*0Sstevel@tonic-gate *EXTENDED_OS_ERROR = *^E ; 191*0Sstevel@tonic-gate *EVAL_ERROR = *@ ; 192*0Sstevel@tonic-gate 193*0Sstevel@tonic-gate# Process info. 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gate *PROCESS_ID = *$ ; 196*0Sstevel@tonic-gate *PID = *$ ; 197*0Sstevel@tonic-gate *REAL_USER_ID = *< ; 198*0Sstevel@tonic-gate *UID = *< ; 199*0Sstevel@tonic-gate *EFFECTIVE_USER_ID = *> ; 200*0Sstevel@tonic-gate *EUID = *> ; 201*0Sstevel@tonic-gate *REAL_GROUP_ID = *( ; 202*0Sstevel@tonic-gate *GID = *( ; 203*0Sstevel@tonic-gate *EFFECTIVE_GROUP_ID = *) ; 204*0Sstevel@tonic-gate *EGID = *) ; 205*0Sstevel@tonic-gate *PROGRAM_NAME = *0 ; 206*0Sstevel@tonic-gate 207*0Sstevel@tonic-gate# Internals. 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gate *PERL_VERSION = *^V ; 210*0Sstevel@tonic-gate *ACCUMULATOR = *^A ; 211*0Sstevel@tonic-gate *COMPILING = *^C ; 212*0Sstevel@tonic-gate *DEBUGGING = *^D ; 213*0Sstevel@tonic-gate *SYSTEM_FD_MAX = *^F ; 214*0Sstevel@tonic-gate *INPLACE_EDIT = *^I ; 215*0Sstevel@tonic-gate *PERLDB = *^P ; 216*0Sstevel@tonic-gate *LAST_REGEXP_CODE_RESULT = *^R ; 217*0Sstevel@tonic-gate *EXCEPTIONS_BEING_CAUGHT = *^S ; 218*0Sstevel@tonic-gate *BASETIME = *^T ; 219*0Sstevel@tonic-gate *WARNING = *^W ; 220*0Sstevel@tonic-gate *EXECUTABLE_NAME = *^X ; 221*0Sstevel@tonic-gate *OSNAME = *^O ; 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate# Deprecated. 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate# *ARRAY_BASE = *[ ; 226*0Sstevel@tonic-gate# *OFMT = *# ; 227*0Sstevel@tonic-gate# *MULTILINE_MATCHING = ** ; 228*0Sstevel@tonic-gate# *OLD_PERL_VERSION = *] ; 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate1; 231