Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/5.18.2/English.pm |
Statements | Executed 367 statements in 1.25ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.13ms | 2.62ms | BEGIN@192 | English::
42 | 42 | 42 | 653µs | 16.6ms | import | English::
1 | 1 | 1 | 140µs | 407µs | BEGIN@153 | English::
1 | 1 | 1 | 14µs | 23µs | BEGIN@52 | English::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package English; | ||||
2 | |||||
3 | 1 | 600ns | our $VERSION = '1.06_01'; | ||
4 | |||||
5 | 1 | 300ns | require Exporter; | ||
6 | 1 | 4µ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; | ||||
15 | use English qw( -no_match_vars ) ; # Avoids regex performance penalty | ||||
16 | # in perl 5.16 and earlier | ||||
17 | ... | ||||
18 | if ($ERRNO =~ /denied/) { ... } | ||||
19 | |||||
20 | =head1 DESCRIPTION | ||||
21 | |||||
22 | This module provides aliases for the built-in variables whose | ||||
23 | names no one seems to like to read. Variables with side-effects | ||||
24 | which get triggered just by accessing them (like $0) will still | ||||
25 | be affected. | ||||
26 | |||||
27 | For those variables that have an B<awk> version, both long | ||||
28 | and short English alternatives are provided. For example, | ||||
29 | the C<$/> variable can be referred to either $RS or | ||||
30 | $INPUT_RECORD_SEPARATOR if you are using the English module. | ||||
31 | |||||
32 | See L<perlvar> for a complete list of these. | ||||
33 | |||||
34 | =head1 PERFORMANCE | ||||
35 | |||||
36 | NOTE: This was fixed in perl 5.20. Mentioning these three variables no | ||||
37 | longer makes a speed difference. This section still applies if your code | ||||
38 | is to run on perl 5.18 or earlier. | ||||
39 | |||||
40 | This module can provoke sizeable inefficiencies for regular expressions, | ||||
41 | due to unfortunate implementation details. If performance matters in | ||||
42 | your application and you don't need $PREMATCH, $MATCH, or $POSTMATCH, | ||||
43 | try doing | ||||
44 | |||||
45 | use English qw( -no_match_vars ) ; | ||||
46 | |||||
47 | . B<It is especially important to do this in modules to avoid penalizing | ||||
48 | all applications which use them.> | ||||
49 | |||||
50 | =cut | ||||
51 | |||||
52 | 2 | 228µs | 2 | 33µs | # spent 23µs (14+10) within English::BEGIN@52 which was called:
# once (14µs+10µs) by Perl::Critic::Command::BEGIN@14 at line 52 # spent 23µs making 1 call to English::BEGIN@52
# spent 10µs making 1 call to warnings::unimport |
53 | |||||
54 | 1 | 100ns | my $globbed_match ; | ||
55 | |||||
56 | # Grandfather $NAME import | ||||
57 | # spent 16.6ms (653µs+15.9) within English::import which was called 42 times, avg 394µs/call:
# once (19µs+1.64ms) by Perl::Critic::Command::BEGIN@14 at line 14 of Perl/Critic/Command.pm
# once (19µs+429µs) by Perl::Critic::Policy::Documentation::PodSpelling::BEGIN@14 at line 14 of Perl/Critic/Policy/Documentation/PodSpelling.pm
# once (19µs+410µs) by Perl::Critic::Exception::Parse::BEGIN@14 at line 14 of Perl/Critic/Exception/Parse.pm
# once (14µs+402µs) by Perl::Critic::Policy::RegularExpressions::ProhibitComplexRegexes::BEGIN@15 at line 15 of Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm
# once (18µs+383µs) by Perl::Critic::Policy::Modules::ProhibitEvilModules::BEGIN@13 at line 13 of Perl/Critic/Policy/Modules/ProhibitEvilModules.pm
# once (27µs+374µs) by Perl::Critic::Statistics::BEGIN@14 at line 14 of Perl/Critic/Statistics.pm
# once (18µs+376µs) by Perl::Critic::Policy::Documentation::RequirePackageMatchesPodName::BEGIN@16 at line 16 of Perl/Critic/Policy/Documentation/RequirePackageMatchesPodName.pm
# once (16µs+373µs) by Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@13 at line 13 of Perl/Critic/Policy/Variables/ProhibitEvilVariables.pm
# once (15µs+373µs) by Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions::BEGIN@13 at line 13 of Perl/Critic/Policy/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.pm
# once (14µs+373µs) by Perl::Critic::UserProfile::BEGIN@14 at line 14 of Perl/Critic/UserProfile.pm
# once (17µs+368µs) by Perl::Critic::Policy::Subroutines::ProhibitManyArgs::BEGIN@18 at line 18 of Perl/Critic/Policy/Subroutines/ProhibitManyArgs.pm
# once (15µs+368µs) by Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines::BEGIN@17 at line 17 of Perl/Critic/Policy/CodeLayout/RequireConsistentNewlines.pm
# once (14µs+367µs) by Perl::Critic::Policy::RegularExpressions::ProhibitEnumeratedClasses::BEGIN@15 at line 15 of Perl/Critic/Policy/RegularExpressions/ProhibitEnumeratedClasses.pm
# once (15µs+366µs) by Perl::Critic::Policy::ValuesAndExpressions::ProhibitComplexVersion::BEGIN@15 at line 15 of Perl/Critic/Policy/ValuesAndExpressions/ProhibitComplexVersion.pm
# once (14µs+366µs) by Perl::Critic::Policy::CodeLayout::RequireTidyCode::BEGIN@14 at line 14 of Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm
# once (15µs+361µs) by Perl::Critic::Policy::ValuesAndExpressions::RequireConstantVersion::BEGIN@15 at line 15 of Perl/Critic/Policy/ValuesAndExpressions/RequireConstantVersion.pm
# once (15µs+360µs) by Perl::Critic::BEGIN@14 at line 14 of Perl/Critic.pm
# once (14µs+361µs) by Perl::Critic::Policy::Documentation::RequirePodLinksIncludeText::BEGIN@16 at line 16 of Perl/Critic/Policy/Documentation/RequirePodLinksIncludeText.pm
# once (15µs+355µs) by Perl::Critic::Annotation::BEGIN@15 at line 15 of Perl/Critic/Annotation.pm
# once (14µs+356µs) by Perl::Critic::Policy::CodeLayout::ProhibitTrailingWhitespace::BEGIN@13 at line 13 of Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm
# once (14µs+356µs) by Perl::Critic::Policy::Subroutines::RequireArgUnpacking::BEGIN@15 at line 15 of Perl/Critic/Policy/Subroutines/RequireArgUnpacking.pm
# once (14µs+355µs) by Perl::Critic::Policy::RegularExpressions::ProhibitSingleCharAlternation::BEGIN@15 at line 15 of Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm
# once (14µs+355µs) by Perl::Critic::Policy::RegularExpressions::ProhibitUnusedCapture::BEGIN@15 at line 15 of Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm
# once (14µs+354µs) by Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters::BEGIN@15 at line 15 of Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm
# once (15µs+353µs) by Perl::Critic::OptionsProcessor::BEGIN@14 at line 14 of Perl/Critic/OptionsProcessor.pm
# once (14µs+354µs) by Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches::BEGIN@15 at line 15 of Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm
# once (14µs+353µs) by Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@15 at line 15 of Perl/Critic/Policy/Objects/ProhibitIndirectSyntax.pm
# once (17µs+349µs) by Perl::Critic::Theme::BEGIN@13 at line 13 of Perl/Critic/Theme.pm
# once (14µs+351µs) by Perl::Critic::Policy::RegularExpressions::ProhibitEscapedMetacharacters::BEGIN@14 at line 14 of Perl/Critic/Policy/RegularExpressions/ProhibitEscapedMetacharacters.pm
# once (14µs+350µs) by Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline::BEGIN@15 at line 15 of Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm
# once (17µs+343µs) by Perl::Critic::Violation::BEGIN@14 at line 14 of Perl/Critic/Violation.pm
# once (14µs+346µs) by Perl::Critic::Policy::Variables::ProhibitPunctuationVars::BEGIN@14 at line 14 of Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm
# once (14µs+345µs) by Perl::Critic::Policy::NamingConventions::Capitalization::BEGIN@14 at line 14 of Perl/Critic/Policy/NamingConventions/Capitalization.pm
# once (14µs+345µs) by Perl::Critic::Exception::AggregateConfiguration::BEGIN@15 at line 15 of Perl/Critic/Exception/AggregateConfiguration.pm
# once (15µs+341µs) by Perl::Critic::Utils::POD::BEGIN@14 at line 14 of Perl/Critic/Utils/POD.pm
# once (16µs+339µs) by Perl::Critic::Policy::BEGIN@14 at line 14 of Perl/Critic/Policy.pm
# once (14µs+338µs) by Perl::Critic::Config::BEGIN@14 at line 14 of Perl/Critic/Config.pm
# once (14µs+335µs) by Perl::Critic::Utils::BEGIN@19 at line 19 of Perl/Critic/Utils.pm
# once (14µs+335µs) by Perl::Critic::PolicyFactory::BEGIN@14 at line 14 of Perl/Critic/PolicyFactory.pm
# once (14µs+334µs) by Perl::Critic::Exception::IO::BEGIN@15 at line 15 of Perl/Critic/Exception/IO.pm
# once (21µs+159µs) by Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines::BEGIN@15 at line 15 of Perl/Critic/Policy/Subroutines/ProhibitUnusedPrivateSubroutines.pm
# once (14µs+58µs) by Perl::Critic::Policy::Subroutines::ProtectPrivateSubs::BEGIN@15 at line 15 of Perl/Critic/Policy/Subroutines/ProtectPrivateSubs.pm | ||||
58 | 42 | 17µs | my $this = shift; | ||
59 | 86 | 262µs | 44 | 65µs | my @list = grep { ! /^-no_match_vars$/ } @_ ; # spent 65µs making 44 calls to English::CORE:match, avg 1µs/call |
60 | 42 | 14µs | local $Exporter::ExportLevel = 1; | ||
61 | 42 | 31µs | if ( @_ == @list ) { | ||
62 | *EXPORT = \@COMPLETE_EXPORT ; | ||||
63 | $globbed_match ||= ( | ||||
64 | eval q{ | ||||
65 | *MATCH = *& ; | ||||
66 | *PREMATCH = *` ; | ||||
67 | *POSTMATCH = *' ; | ||||
68 | 1 ; | ||||
69 | } | ||||
70 | || do { | ||||
71 | require Carp ; | ||||
72 | Carp::croak("Can't create English for match leftovers: $@") ; | ||||
73 | } | ||||
74 | ) ; | ||||
75 | } | ||||
76 | else { | ||||
77 | 42 | 21µs | *EXPORT = \@MINIMAL_EXPORT ; | ||
78 | } | ||||
79 | 44 | 215µs | 44 | 15.8ms | Exporter::import($this,grep {s/^\$/*/} @list); # spent 15.8ms making 42 calls to Exporter::import, avg 377µs/call
# spent 2µs making 2 calls to English::CORE:subst, avg 1µs/call |
80 | } | ||||
81 | |||||
82 | 1 | 10µs | @MINIMAL_EXPORT = qw( | ||
83 | *ARG | ||||
84 | *LAST_PAREN_MATCH | ||||
85 | *INPUT_LINE_NUMBER | ||||
86 | *NR | ||||
87 | *INPUT_RECORD_SEPARATOR | ||||
88 | *RS | ||||
89 | *OUTPUT_AUTOFLUSH | ||||
90 | *OUTPUT_FIELD_SEPARATOR | ||||
91 | *OFS | ||||
92 | *OUTPUT_RECORD_SEPARATOR | ||||
93 | *ORS | ||||
94 | *LIST_SEPARATOR | ||||
95 | *SUBSCRIPT_SEPARATOR | ||||
96 | *SUBSEP | ||||
97 | *FORMAT_PAGE_NUMBER | ||||
98 | *FORMAT_LINES_PER_PAGE | ||||
99 | *FORMAT_LINES_LEFT | ||||
100 | *FORMAT_NAME | ||||
101 | *FORMAT_TOP_NAME | ||||
102 | *FORMAT_LINE_BREAK_CHARACTERS | ||||
103 | *FORMAT_FORMFEED | ||||
104 | *CHILD_ERROR | ||||
105 | *OS_ERROR | ||||
106 | *ERRNO | ||||
107 | *EXTENDED_OS_ERROR | ||||
108 | *EVAL_ERROR | ||||
109 | *PROCESS_ID | ||||
110 | *PID | ||||
111 | *REAL_USER_ID | ||||
112 | *UID | ||||
113 | *EFFECTIVE_USER_ID | ||||
114 | *EUID | ||||
115 | *REAL_GROUP_ID | ||||
116 | *GID | ||||
117 | *EFFECTIVE_GROUP_ID | ||||
118 | *EGID | ||||
119 | *PROGRAM_NAME | ||||
120 | *PERL_VERSION | ||||
121 | *ACCUMULATOR | ||||
122 | *COMPILING | ||||
123 | *DEBUGGING | ||||
124 | *SYSTEM_FD_MAX | ||||
125 | *INPLACE_EDIT | ||||
126 | *PERLDB | ||||
127 | *BASETIME | ||||
128 | *WARNING | ||||
129 | *EXECUTABLE_NAME | ||||
130 | *OSNAME | ||||
131 | *LAST_REGEXP_CODE_RESULT | ||||
132 | *EXCEPTIONS_BEING_CAUGHT | ||||
133 | *LAST_SUBMATCH_RESULT | ||||
134 | @LAST_MATCH_START | ||||
135 | @LAST_MATCH_END | ||||
136 | ); | ||||
137 | |||||
138 | |||||
139 | 1 | 500ns | @MATCH_EXPORT = qw( | ||
140 | *MATCH | ||||
141 | *PREMATCH | ||||
142 | *POSTMATCH | ||||
143 | ); | ||||
144 | |||||
145 | 1 | 7µs | @COMPLETE_EXPORT = ( @MINIMAL_EXPORT, @MATCH_EXPORT ) ; | ||
146 | |||||
147 | # The ground of all being. | ||||
148 | |||||
149 | 1 | 600ns | *ARG = *_ ; | ||
150 | |||||
151 | # Matching. | ||||
152 | |||||
153 | 3 | 210µs | 1 | 407µs | # spent 407µs (140+267) within English::BEGIN@153 which was called:
# once (140µs+267µs) by Perl::Critic::Command::BEGIN@14 at line 153 # spent 407µs making 1 call to English::BEGIN@153 |
154 | 1 | 200ns | *LAST_SUBMATCH_RESULT = *^N ; | ||
155 | 1 | 800ns | *LAST_MATCH_START = *-{ARRAY} ; | ||
156 | 1 | 100ns | *LAST_MATCH_END = *+{ARRAY} ; | ||
157 | |||||
158 | # Input. | ||||
159 | |||||
160 | 1 | 200ns | *INPUT_LINE_NUMBER = *. ; | ||
161 | 1 | 200ns | *NR = *. ; | ||
162 | 1 | 200ns | *INPUT_RECORD_SEPARATOR = */ ; | ||
163 | 1 | 200ns | *RS = */ ; | ||
164 | |||||
165 | # Output. | ||||
166 | |||||
167 | 1 | 200ns | *OUTPUT_AUTOFLUSH = *| ; | ||
168 | 1 | 200ns | *OUTPUT_FIELD_SEPARATOR = *, ; | ||
169 | 1 | 300ns | *OFS = *, ; | ||
170 | 1 | 100ns | *OUTPUT_RECORD_SEPARATOR = *\ ; | ||
171 | 1 | 200ns | *ORS = *\ ; | ||
172 | |||||
173 | # Interpolation "constants". | ||||
174 | |||||
175 | 1 | 200ns | *LIST_SEPARATOR = *" ; | ||
176 | 1 | 200ns | *SUBSCRIPT_SEPARATOR = *; ; | ||
177 | 1 | 200ns | *SUBSEP = *; ; | ||
178 | |||||
179 | # Formats | ||||
180 | |||||
181 | 1 | 200ns | *FORMAT_PAGE_NUMBER = *% ; | ||
182 | 1 | 200ns | *FORMAT_LINES_PER_PAGE = *= ; | ||
183 | 1 | 100ns | *FORMAT_LINES_LEFT = *- ; | ||
184 | 1 | 100ns | *FORMAT_NAME = *~ ; | ||
185 | 1 | 200ns | *FORMAT_TOP_NAME = *^ ; | ||
186 | 1 | 100ns | *FORMAT_LINE_BREAK_CHARACTERS = *: ; | ||
187 | 1 | 100ns | *FORMAT_FORMFEED = *^L ; | ||
188 | |||||
189 | # Error status. | ||||
190 | |||||
191 | 1 | 100ns | *CHILD_ERROR = *? ; | ||
192 | 3 | 206µs | 1 | 2.62ms | # spent 2.62ms (1.13+1.49) within English::BEGIN@192 which was called:
# once (1.13ms+1.49ms) by Perl::Critic::Command::BEGIN@14 at line 192 # spent 2.62ms making 1 call to English::BEGIN@192 |
193 | 1 | 200ns | *ERRNO = *! ; | ||
194 | 1 | 100ns | *OS_ERROR = *! ; | ||
195 | 1 | 100ns | *ERRNO = *! ; | ||
196 | 1 | 200ns | *EXTENDED_OS_ERROR = *^E ; | ||
197 | 1 | 100ns | *EVAL_ERROR = *@ ; | ||
198 | |||||
199 | # Process info. | ||||
200 | |||||
201 | 1 | 200ns | *PROCESS_ID = *$ ; | ||
202 | 1 | 200ns | *PID = *$ ; | ||
203 | 1 | 100ns | *REAL_USER_ID = *< ; | ||
204 | 1 | 200ns | *UID = *< ; | ||
205 | 1 | 100ns | *EFFECTIVE_USER_ID = *> ; | ||
206 | 1 | 100ns | *EUID = *> ; | ||
207 | 1 | 100ns | *REAL_GROUP_ID = *( ; | ||
208 | 1 | 100ns | *GID = *( ; | ||
209 | 1 | 100ns | *EFFECTIVE_GROUP_ID = *) ; | ||
210 | 1 | 200ns | *EGID = *) ; | ||
211 | 1 | 200ns | *PROGRAM_NAME = *0 ; | ||
212 | |||||
213 | # Internals. | ||||
214 | |||||
215 | 1 | 200ns | *PERL_VERSION = *^V ; | ||
216 | 1 | 100ns | *ACCUMULATOR = *^A ; | ||
217 | 1 | 100ns | *COMPILING = *^C ; | ||
218 | 1 | 100ns | *DEBUGGING = *^D ; | ||
219 | 1 | 100ns | *SYSTEM_FD_MAX = *^F ; | ||
220 | 1 | 100ns | *INPLACE_EDIT = *^I ; | ||
221 | 1 | 100ns | *PERLDB = *^P ; | ||
222 | 1 | 100ns | *LAST_REGEXP_CODE_RESULT = *^R ; | ||
223 | 1 | 100ns | *EXCEPTIONS_BEING_CAUGHT = *^S ; | ||
224 | 1 | 100ns | *BASETIME = *^T ; | ||
225 | 1 | 200ns | *WARNING = *^W ; | ||
226 | 1 | 100ns | *EXECUTABLE_NAME = *^X ; | ||
227 | 1 | 200ns | *OSNAME = *^O ; | ||
228 | |||||
229 | # Deprecated. | ||||
230 | |||||
231 | # *ARRAY_BASE = *[ ; | ||||
232 | # *OFMT = *# ; | ||||
233 | # *OLD_PERL_VERSION = *] ; | ||||
234 | |||||
235 | 1 | 14µs | 1; |