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