Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/strictures.pm |
Statements | Executed 724 statements in 2.95ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
18 | 1 | 1 | 345µs | 14.0ms | _enable_2 | strictures::
22 | 22 | 22 | 330µs | 476µs | VERSION | strictures::
22 | 22 | 22 | 216µs | 14.7ms | import | strictures::
22 | 1 | 1 | 187µs | 14.5ms | _enable | strictures::
22 | 2 | 1 | 121µs | 192µs | _want_extra | strictures::
22 | 1 | 1 | 51µs | 51µs | _want_extra_env | strictures::
4 | 1 | 1 | 50µs | 259µs | _enable_1 | strictures::
1 | 1 | 1 | 23µs | 25µs | BEGIN@3 | strictures::
22 | 1 | 1 | 20µs | 20µs | CORE:match (opcode) | strictures::
1 | 1 | 1 | 7µs | 38µs | BEGIN@4 | strictures::
1 | 1 | 1 | 6µs | 20µs | BEGIN@97 | strictures::
1 | 1 | 1 | 5µs | 5µs | BEGIN@6 | strictures::
0 | 0 | 0 | 0s | 0s | _load_extras | strictures::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package strictures; | ||||
2 | |||||
3 | 2 | 31µs | 2 | 27µs | # spent 25µs (23+2) within strictures::BEGIN@3 which was called:
# once (23µs+2µs) by OpenAPI::Modern::BEGIN@12 at line 3 # spent 25µs making 1 call to strictures::BEGIN@3
# spent 2µs making 1 call to strict::import |
4 | 2 | 105µs | 2 | 69µs | # spent 38µs (7+31) within strictures::BEGIN@4 which was called:
# once (7µs+31µs) by OpenAPI::Modern::BEGIN@12 at line 4 # spent 38µs making 1 call to strictures::BEGIN@4
# spent 31µs making 1 call to warnings::import |
5 | |||||
6 | # spent 5µs within strictures::BEGIN@6 which was called:
# once (5µs+0s) by OpenAPI::Modern::BEGIN@12 at line 11 | ||||
7 | 1 | 2µs | *_PERL_LT_5_8_4 = ("$]" < 5.008004) ? sub(){1} : sub(){0}; | ||
8 | # goto &UNIVERSAL::VERSION usually works on 5.8, but fails on some ARM | ||||
9 | # machines. Seems to always work on 5.10 though. | ||||
10 | 1 | 4µs | *_CAN_GOTO_VERSION = ("$]" >= 5.010000) ? sub(){1} : sub(){0}; | ||
11 | 1 | 148µs | 1 | 5µs | } # spent 5µs making 1 call to strictures::BEGIN@6 |
12 | |||||
13 | 1 | 0s | our $VERSION = '2.000006'; | ||
14 | 1 | 1µs | $VERSION =~ tr/_//d; | ||
15 | |||||
16 | 1 | 21µs | our @WARNING_CATEGORIES = grep { exists $warnings::Offsets{$_} } qw( | ||
17 | closure | ||||
18 | chmod | ||||
19 | deprecated | ||||
20 | exiting | ||||
21 | experimental | ||||
22 | experimental::alpha_assertions | ||||
23 | experimental::autoderef | ||||
24 | experimental::bitwise | ||||
25 | experimental::const_attr | ||||
26 | experimental::declared_refs | ||||
27 | experimental::lexical_subs | ||||
28 | experimental::lexical_topic | ||||
29 | experimental::postderef | ||||
30 | experimental::private_use | ||||
31 | experimental::re_strict | ||||
32 | experimental::refaliasing | ||||
33 | experimental::regex_sets | ||||
34 | experimental::script_run | ||||
35 | experimental::signatures | ||||
36 | experimental::smartmatch | ||||
37 | experimental::win32_perlio | ||||
38 | glob | ||||
39 | imprecision | ||||
40 | io | ||||
41 | closed | ||||
42 | exec | ||||
43 | layer | ||||
44 | newline | ||||
45 | pipe | ||||
46 | syscalls | ||||
47 | unopened | ||||
48 | locale | ||||
49 | misc | ||||
50 | missing | ||||
51 | numeric | ||||
52 | once | ||||
53 | overflow | ||||
54 | pack | ||||
55 | portable | ||||
56 | recursion | ||||
57 | redefine | ||||
58 | redundant | ||||
59 | regexp | ||||
60 | severe | ||||
61 | debugging | ||||
62 | inplace | ||||
63 | internal | ||||
64 | malloc | ||||
65 | shadow | ||||
66 | signal | ||||
67 | substr | ||||
68 | syntax | ||||
69 | ambiguous | ||||
70 | bareword | ||||
71 | digit | ||||
72 | illegalproto | ||||
73 | parenthesis | ||||
74 | precedence | ||||
75 | printf | ||||
76 | prototype | ||||
77 | qw | ||||
78 | reserved | ||||
79 | semicolon | ||||
80 | taint | ||||
81 | threads | ||||
82 | uninitialized | ||||
83 | umask | ||||
84 | unpack | ||||
85 | untie | ||||
86 | utf8 | ||||
87 | non_unicode | ||||
88 | nonchar | ||||
89 | surrogate | ||||
90 | void | ||||
91 | void_unusual | ||||
92 | y2k | ||||
93 | ); | ||||
94 | |||||
95 | # spent 476µs (330+146) within strictures::VERSION which was called 22 times, avg 22µs/call:
# once (22µs+16µs) by Data::Perl::Role::Collection::Array::BEGIN@5 at line 5 of Data/Perl/Role/Collection/Array.pm
# once (21µs+9µs) by OpenAPI::Modern::BEGIN@12 at line 12 of OpenAPI/Modern.pm
# once (19µs+8µs) by Data::Perl::Collection::Hash::MooseLike::BEGIN@5 at line 5 of Data/Perl/Collection/Hash/MooseLike.pm
# once (18µs+9µs) by JSON::Schema::Modern::Vocabulary::MetaData::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/MetaData.pm
# once (18µs+8µs) by Data::Perl::Role::Collection::Hash::BEGIN@5 at line 5 of Data/Perl/Role/Collection/Hash.pm
# once (17µs+8µs) by Data::Perl::Collection::Array::MooseLike::BEGIN@5 at line 5 of Data/Perl/Collection/Array/MooseLike.pm
# once (16µs+6µs) by JSON::Schema::Modern::BEGIN@12 at line 12 of JSON/Schema/Modern.pm
# once (16µs+5µs) by JSON::Schema::Modern::Utilities::BEGIN@10 at line 10 of JSON/Schema/Modern/Utilities.pm
# once (15µs+6µs) by JSON::Schema::Modern::Document::OpenAPI::BEGIN@12 at line 12 of JSON/Schema/Modern/Document/OpenAPI.pm
# once (15µs+6µs) by JSON::Schema::Modern::Error::BEGIN@11 at line 11 of JSON/Schema/Modern/Error.pm
# once (14µs+6µs) by JSON::Schema::Modern::Document::BEGIN@11 at line 11 of JSON/Schema/Modern/Document.pm
# once (15µs+5µs) by JSON::Schema::Modern::Annotation::BEGIN@11 at line 11 of JSON/Schema/Modern/Annotation.pm
# once (14µs+6µs) by JSON::Schema::Modern::Vocabulary::Core::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Core.pm
# once (13µs+6µs) by JSON::Schema::Modern::Vocabulary::FormatAnnotation::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm
# once (13µs+6µs) by JSON::Schema::Modern::Vocabulary::Content::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Content.pm
# once (13µs+6µs) by JSON::Schema::Modern::Vocabulary::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary.pm
# once (13µs+6µs) by JSON::Schema::Modern::Result::BEGIN@11 at line 11 of JSON/Schema/Modern/Result.pm
# once (13µs+6µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Applicator.pm
# once (14µs+5µs) by JSON::Schema::Modern::Vocabulary::OpenAPI::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm
# once (11µs+4µs) by JSON::Schema::Modern::Vocabulary::Unevaluated::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Unevaluated.pm
# once (10µs+5µs) by JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/FormatAssertion.pm
# once (10µs+4µs) by JSON::Schema::Modern::Vocabulary::Validation::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Validation.pm | ||||
96 | { | ||||
97 | 24 | 873µs | 2 | 34µs | # spent 20µs (6+14) within strictures::BEGIN@97 which was called:
# once (6µs+14µs) by OpenAPI::Modern::BEGIN@12 at line 97 # spent 20µs making 1 call to strictures::BEGIN@97
# spent 14µs making 1 call to warnings::unimport |
98 | 22 | 5µs | local $@; | ||
99 | 66 | 311µs | 22 | 146µs | if (defined $_[1] && eval { &UNIVERSAL::VERSION; 1}) { # spent 146µs making 22 calls to UNIVERSAL::VERSION, avg 7µs/call |
100 | 22 | 26µs | $^H |= 0x20000 | ||
101 | unless _PERL_LT_5_8_4; | ||||
102 | 22 | 66µs | $^H{strictures_enable} = int $_[1]; | ||
103 | } | ||||
104 | } | ||||
105 | 22 | 333µs | 22 | 13µs | _CAN_GOTO_VERSION ? goto &UNIVERSAL::VERSION : &UNIVERSAL::VERSION; # spent 13µs making 22 calls to UNIVERSAL::VERSION, avg 591ns/call |
106 | } | ||||
107 | |||||
108 | our %extra_load_states; | ||||
109 | |||||
110 | our $Smells_Like_VCS; | ||||
111 | |||||
112 | # spent 14.7ms (216µs+14.5) within strictures::import which was called 22 times, avg 669µs/call:
# once (10µs+965µs) by OpenAPI::Modern::BEGIN@12 at line 12 of OpenAPI/Modern.pm
# once (10µs+935µs) by JSON::Schema::Modern::Vocabulary::Core::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Core.pm
# once (13µs+911µs) by JSON::Schema::Modern::BEGIN@12 at line 12 of JSON/Schema/Modern.pm
# once (9µs+911µs) by JSON::Schema::Modern::Vocabulary::Content::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Content.pm
# once (9µs+909µs) by JSON::Schema::Modern::Vocabulary::FormatAnnotation::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/FormatAnnotation.pm
# once (7µs+868µs) by JSON::Schema::Modern::Vocabulary::MetaData::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/MetaData.pm
# once (8µs+867µs) by JSON::Schema::Modern::Vocabulary::OpenAPI::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/OpenAPI.pm
# once (11µs+849µs) by JSON::Schema::Modern::Document::OpenAPI::BEGIN@12 at line 12 of JSON/Schema/Modern/Document/OpenAPI.pm
# once (12µs+830µs) by JSON::Schema::Modern::Annotation::BEGIN@11 at line 11 of JSON/Schema/Modern/Annotation.pm
# once (10µs+832µs) by JSON::Schema::Modern::Result::BEGIN@11 at line 11 of JSON/Schema/Modern/Result.pm
# once (11µs+828µs) by JSON::Schema::Modern::Utilities::BEGIN@10 at line 10 of JSON/Schema/Modern/Utilities.pm
# once (10µs+760µs) by JSON::Schema::Modern::Vocabulary::Applicator::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Applicator.pm
# once (10µs+741µs) by JSON::Schema::Modern::Error::BEGIN@11 at line 11 of JSON/Schema/Modern/Error.pm
# once (10µs+722µs) by JSON::Schema::Modern::Vocabulary::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary.pm
# once (7µs+593µs) by JSON::Schema::Modern::Vocabulary::Validation::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Validation.pm
# once (7µs+580µs) by JSON::Schema::Modern::Vocabulary::FormatAssertion::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/FormatAssertion.pm
# once (8µs+562µs) by JSON::Schema::Modern::Document::BEGIN@11 at line 11 of JSON/Schema/Modern/Document.pm
# once (7µs+534µs) by JSON::Schema::Modern::Vocabulary::Unevaluated::BEGIN@11 at line 11 of JSON/Schema/Modern/Vocabulary/Unevaluated.pm
# once (12µs+92µs) by Data::Perl::Role::Collection::Array::BEGIN@5 at line 5 of Data/Perl/Role/Collection/Array.pm
# once (15µs+77µs) by Data::Perl::Collection::Array::MooseLike::BEGIN@5 at line 5 of Data/Perl/Collection/Array/MooseLike.pm
# once (13µs+73µs) by Data::Perl::Collection::Hash::MooseLike::BEGIN@5 at line 5 of Data/Perl/Collection/Hash/MooseLike.pm
# once (7µs+55µs) by Data::Perl::Role::Collection::Hash::BEGIN@5 at line 5 of Data/Perl/Role/Collection/Hash.pm | ||||
113 | 22 | 5µs | my $class = shift; | ||
114 | 22 | 32µs | my %opts = @_ == 1 ? %{$_[0]} : @_; | ||
115 | 22 | 63µs | if (!exists $opts{version}) { | ||
116 | $opts{version} | ||||
117 | = exists $^H{strictures_enable} ? delete $^H{strictures_enable} | ||||
118 | : int $VERSION; | ||||
119 | } | ||||
120 | 22 | 44µs | $opts{file} = (caller)[1]; | ||
121 | 22 | 117µs | 22 | 14.5ms | $class->_enable(\%opts); # spent 14.5ms making 22 calls to strictures::_enable, avg 659µs/call |
122 | } | ||||
123 | |||||
124 | # spent 14.5ms (187µs+14.3) within strictures::_enable which was called 22 times, avg 659µs/call:
# 22 times (187µs+14.3ms) by strictures::import at line 121, avg 659µs/call | ||||
125 | 22 | 5µs | my ($class, $opts) = @_; | ||
126 | 22 | 10µs | my $version = $opts->{version}; | ||
127 | 22 | 6µs | $version = 'undef' | ||
128 | if !defined $version; | ||||
129 | 22 | 14µs | my $method = "_enable_$version"; | ||
130 | 22 | 115µs | 22 | 41µs | if (!$class->can($method)) { # spent 41µs making 22 calls to UNIVERSAL::can, avg 2µs/call |
131 | require Carp; | ||||
132 | Carp::croak("Major version specified as $version - not supported!"); | ||||
133 | } | ||||
134 | 22 | 69µs | 22 | 14.3ms | $class->$method($opts); # spent 14.0ms making 18 calls to strictures::_enable_2, avg 778µs/call
# spent 259µs making 4 calls to strictures::_enable_1, avg 65µs/call |
135 | } | ||||
136 | |||||
137 | # spent 259µs (50+209) within strictures::_enable_1 which was called 4 times, avg 65µs/call:
# 4 times (50µs+209µs) by strictures::_enable at line 134, avg 65µs/call | ||||
138 | 4 | 3µs | my ($class, $opts) = @_; | ||
139 | 4 | 22µs | 4 | 9µs | strict->import; # spent 9µs making 4 calls to strict::import, avg 2µs/call |
140 | 4 | 15µs | 4 | 163µs | warnings->import(FATAL => 'all'); # spent 163µs making 4 calls to warnings::import, avg 41µs/call |
141 | |||||
142 | 4 | 16µs | 4 | 37µs | if (_want_extra($opts->{file})) { # spent 37µs making 4 calls to strictures::_want_extra, avg 9µs/call |
143 | _load_extras(qw(indirect multidimensional bareword::filehandles)); | ||||
144 | indirect->unimport(':fatal') | ||||
145 | if $extra_load_states{indirect}; | ||||
146 | multidimensional->unimport | ||||
147 | if $extra_load_states{multidimensional}; | ||||
148 | bareword::filehandles->unimport | ||||
149 | if $extra_load_states{'bareword::filehandles'}; | ||||
150 | } | ||||
151 | } | ||||
152 | |||||
153 | 1 | 2µs | our @V2_NONFATAL = grep { exists $warnings::Offsets{$_} } ( | ||
154 | 'exec', # not safe to catch | ||||
155 | 'recursion', # will be caught by other mechanisms | ||||
156 | 'internal', # not safe to catch | ||||
157 | 'malloc', # not safe to catch | ||||
158 | 'newline', # stat on nonexistent file with a newline in it | ||||
159 | 'experimental', # no reason for these to be fatal | ||||
160 | 'deprecated', # unfortunately can't make these fatal | ||||
161 | 'portable', # everything worked fine here, just may not elsewhere | ||||
162 | ); | ||||
163 | 1 | 0s | our @V2_DISABLE = grep { exists $warnings::Offsets{$_} } ( | ||
164 | 'once' # triggers inconsistently, can't be fatalized | ||||
165 | ); | ||||
166 | |||||
167 | # spent 14.0ms (345µs+13.7) within strictures::_enable_2 which was called 18 times, avg 778µs/call:
# 18 times (345µs+13.7ms) by strictures::_enable at line 134, avg 778µs/call | ||||
168 | 18 | 10µs | my ($class, $opts) = @_; | ||
169 | 18 | 70µs | 18 | 21µs | strict->import; # spent 21µs making 18 calls to strict::import, avg 1µs/call |
170 | 18 | 15µs | 18 | 319µs | warnings->import; # spent 319µs making 18 calls to warnings::import, avg 18µs/call |
171 | 18 | 30µs | 18 | 11.7ms | warnings->import(FATAL => @WARNING_CATEGORIES); # spent 11.7ms making 18 calls to warnings::import, avg 647µs/call |
172 | 18 | 27µs | 18 | 280µs | warnings->unimport(FATAL => @V2_NONFATAL); # spent 280µs making 18 calls to warnings::unimport, avg 16µs/call |
173 | 18 | 15µs | 18 | 1.15ms | warnings->import(@V2_NONFATAL); # spent 1.15ms making 18 calls to warnings::import, avg 64µs/call |
174 | 18 | 21µs | 18 | 92µs | warnings->unimport(@V2_DISABLE); # spent 92µs making 18 calls to warnings::unimport, avg 5µs/call |
175 | |||||
176 | 18 | 68µs | 18 | 155µs | if (_want_extra($opts->{file})) { # spent 155µs making 18 calls to strictures::_want_extra, avg 9µs/call |
177 | _load_extras(qw(indirect multidimensional bareword::filehandles)); | ||||
178 | indirect->unimport(':fatal') | ||||
179 | if $extra_load_states{indirect}; | ||||
180 | multidimensional->unimport | ||||
181 | if $extra_load_states{multidimensional}; | ||||
182 | bareword::filehandles->unimport | ||||
183 | if $extra_load_states{'bareword::filehandles'}; | ||||
184 | } | ||||
185 | } | ||||
186 | |||||
187 | # spent 51µs within strictures::_want_extra_env which was called 22 times, avg 2µs/call:
# 22 times (51µs+0s) by strictures::_want_extra at line 200, avg 2µs/call | ||||
188 | 22 | 22µs | if (exists $ENV{PERL_STRICTURES_EXTRA}) { | ||
189 | if (_PERL_LT_5_8_4 and $ENV{PERL_STRICTURES_EXTRA}) { | ||||
190 | die 'PERL_STRICTURES_EXTRA checks are not available on perls older' | ||||
191 | . "than 5.8.4: please unset \$ENV{PERL_STRICTURES_EXTRA}\n"; | ||||
192 | } | ||||
193 | return $ENV{PERL_STRICTURES_EXTRA} ? 1 : 0; | ||||
194 | } | ||||
195 | 22 | 40µs | return undef; | ||
196 | } | ||||
197 | |||||
198 | sub _want_extra { | ||||
199 | 22 | 6µs | my $file = shift; | ||
200 | 22 | 28µs | 22 | 51µs | my $want_env = _want_extra_env(); # spent 51µs making 22 calls to strictures::_want_extra_env, avg 2µs/call |
201 | 22 | 14µs | return $want_env | ||
202 | if defined $want_env; | ||||
203 | return ( | ||||
204 | 22 | 103µs | 22 | 20µs | !_PERL_LT_5_8_4 # spent 20µs making 22 calls to strictures::CORE:match, avg 909ns/call |
205 | and $file =~ /^(?:t|xt|lib|blib)[\\\/]/ | ||||
206 | and defined $Smells_Like_VCS ? $Smells_Like_VCS | ||||
207 | : ( $Smells_Like_VCS = !!( | ||||
208 | -e '.git' || -e '.svn' || -e '.hg' || -e '.bzr' | ||||
209 | || (-e '../../dist.ini' | ||||
210 | && (-e '../../.git' || -e '../../.svn' || -e '../../.hg' || -e '../../.bzr' )) | ||||
211 | )) | ||||
212 | ); | ||||
213 | } | ||||
214 | |||||
215 | sub _load_extras { | ||||
216 | my @extras = @_; | ||||
217 | my @failed; | ||||
218 | foreach my $mod (@extras) { | ||||
219 | next | ||||
220 | if exists $extra_load_states{$mod}; | ||||
221 | |||||
222 | $extra_load_states{$mod} = eval "require $mod; 1;" or do { | ||||
223 | push @failed, $mod; | ||||
224 | |||||
225 | #work around 5.8 require bug | ||||
226 | (my $file = $mod) =~ s|::|/|g; | ||||
227 | delete $INC{"${file}.pm"}; | ||||
228 | }; | ||||
229 | } | ||||
230 | |||||
231 | if (@failed) { | ||||
232 | my $failed = join ' ', @failed; | ||||
233 | my $extras = join ' ', @extras; | ||||
234 | print STDERR <<EOE; | ||||
235 | strictures.pm extra testing active but couldn't load all modules. Missing were: | ||||
236 | |||||
237 | $failed | ||||
238 | |||||
239 | Extra testing is auto-enabled in checkouts only, so if you're the author | ||||
240 | of a strictures-using module you need to run: | ||||
241 | |||||
242 | cpan $extras | ||||
243 | |||||
244 | but these modules are not required by your users. | ||||
245 | EOE | ||||
246 | } | ||||
247 | } | ||||
248 | |||||
249 | 1 | 12µs | 1; | ||
250 | |||||
251 | __END__ | ||||
# spent 20µs within strictures::CORE:match which was called 22 times, avg 909ns/call:
# 22 times (20µs+0s) by strictures::_want_extra at line 204, avg 909ns/call |