Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm |
Statements | Executed 2204 statements in 7.44ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
504 | 1 | 1 | 8.70ms | 33.5ms | violates | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
144 | 1 | 1 | 2.61ms | 1.43s | prepare_to_scan_document | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 644µs | 873µs | BEGIN@14 | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
144 | 1 | 1 | 282µs | 282µs | applies_to | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 16µs | 16µs | BEGIN@10 | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 7µs | 188µs | BEGIN@16 | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 7µs | 19µs | BEGIN@11 | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 7µs | 11µs | BEGIN@12 | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 7µs | 27µs | BEGIN@13 | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 7µs | 57µs | BEGIN@17 | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 6µs | 8µs | default_severity | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
1 | 1 | 1 | 2µs | 2µs | supported_parameters | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | ############################################################################## | ||||
2 | # $URL$ | ||||
3 | # $Date$ | ||||
4 | # $Author$ | ||||
5 | # $Revision$ | ||||
6 | ############################################################################## | ||||
7 | |||||
8 | package Perl::Critic::Policy::Variables::RequireLexicalLoopIterators; | ||||
9 | |||||
10 | 2 | 40µs | 1 | 16µs | # spent 16µs within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@10 which was called:
# once (16µs+0s) by Module::Pluggable::Object::_require at line 10 # spent 16µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@10 |
11 | 2 | 29µs | 2 | 30µs | # spent 19µs (7+11) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@11 which was called:
# once (7µs+11µs) by Module::Pluggable::Object::_require at line 11 # spent 19µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@11
# spent 12µs making 1 call to strict::import |
12 | 2 | 18µs | 2 | 14µs | # spent 11µs (7+4) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@12 which was called:
# once (7µs+4µs) by Module::Pluggable::Object::_require at line 12 # spent 11µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | 2 | 19µs | 2 | 47µs | # spent 27µs (7+20) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@13 which was called:
# once (7µs+20µs) by Module::Pluggable::Object::_require at line 13 # spent 27µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@13
# spent 20µs making 1 call to Exporter::import |
14 | 2 | 96µs | 1 | 873µs | # spent 873µs (644+229) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@14 which was called:
# once (644µs+229µs) by Module::Pluggable::Object::_require at line 14 # spent 873µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@14 |
15 | |||||
16 | 2 | 24µs | 2 | 368µs | # spent 188µs (7+180) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@16 which was called:
# once (7µs+180µs) by Module::Pluggable::Object::_require at line 16 # spent 188µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@16
# spent 180µs making 1 call to Exporter::import |
17 | 2 | 217µs | 2 | 106µs | # spent 57µs (7+50) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@17 which was called:
# once (7µs+50µs) by Module::Pluggable::Object::_require at line 17 # spent 57µs making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@17
# spent 50µs making 1 call to base::import |
18 | |||||
19 | 1 | 600ns | our $VERSION = '1.121'; | ||
20 | |||||
21 | #----------------------------------------------------------------------------- | ||||
22 | |||||
23 | 1 | 2µs | 1 | 29µs | Readonly::Scalar my $DESC => q{Loop iterator is not lexical}; # spent 29µs making 1 call to Readonly::Scalar |
24 | 1 | 2µs | 1 | 42µs | Readonly::Scalar my $EXPL => [ 108 ]; # spent 42µs making 1 call to Readonly::Scalar |
25 | |||||
26 | 1 | 12µs | 2 | 27µs | Readonly::Scalar my $MINIMUM_PERL_VERSION => version->new( 5.004 ); # spent 22µs making 1 call to Readonly::Scalar
# spent 6µs making 1 call to version::new |
27 | |||||
28 | #----------------------------------------------------------------------------- | ||||
29 | |||||
30 | 1 | 5µs | # spent 2µs within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::supported_parameters which was called:
# once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||
31 | 1 | 2µs | # spent 8µs (6+1) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::default_severity which was called:
# once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
32 | sub default_themes { return qw(core pbp bugs certrec ) } | ||||
33 | 144 | 405µs | # spent 282µs within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::applies_to which was called 144 times, avg 2µs/call:
# 144 times (282µs+0s) by Perl::Critic::_critique at line 165 of Perl/Critic.pm, avg 2µs/call | ||
34 | |||||
35 | #----------------------------------------------------------------------------- | ||||
36 | |||||
37 | # spent 1.43s (2.61ms+1.43) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::prepare_to_scan_document which was called 144 times, avg 9.92ms/call:
# 144 times (2.61ms+1.43s) by Perl::Critic::_critique at line 157 of Perl/Critic.pm, avg 9.92ms/call | ||||
38 | 144 | 57µs | my ( $self, $document ) = @_; | ||
39 | # perl5004delta says that is when lexical iterators were introduced, | ||||
40 | # so ... (RT 67760) | ||||
41 | 144 | 549µs | 144 | 1.42s | my $version = $document->highest_explicit_perl_version(); # spent 1.42s making 144 calls to Perl::Critic::Document::highest_explicit_perl_version, avg 9.89ms/call |
42 | 144 | 2.75ms | 710 | 2.25ms | return ! $version || $version >= $MINIMUM_PERL_VERSION; # spent 1.32ms making 142 calls to version::(<=>, avg 9µs/call
# spent 546µs making 426 calls to Readonly::Scalar::FETCH, avg 1µs/call
# spent 385µs making 142 calls to version::(bool, avg 3µs/call |
43 | } | ||||
44 | |||||
45 | #----------------------------------------------------------------------------- | ||||
46 | |||||
47 | # spent 33.5ms (8.70+24.8) within Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::violates which was called 504 times, avg 66µs/call:
# 504 times (8.70ms+24.8ms) by Perl::Critic::_critique at line 183 of Perl/Critic.pm, avg 66µs/call | ||||
48 | 504 | 171µs | my ( $self, $elem, undef ) = @_; | ||
49 | |||||
50 | # First child will be 'for' or 'foreach' keyword | ||||
51 | 504 | 1.40ms | 504 | 21.4ms | return if $elem->type() ne 'foreach'; # spent 21.4ms making 504 calls to PPI::Statement::Compound::type, avg 43µs/call |
52 | |||||
53 | 86 | 116µs | 86 | 482µs | my $first_child = $elem->schild(0); # spent 482µs making 86 calls to PPI::Node::schild, avg 6µs/call |
54 | 86 | 242µs | 86 | 53µs | return if not $first_child; # spent 53µs making 86 calls to PPI::Util::TRUE, avg 612ns/call |
55 | 86 | 306µs | 86 | 91µs | my $start = $first_child->isa('PPI::Token::Label') ? 1 : 0; # spent 91µs making 86 calls to UNIVERSAL::isa, avg 1µs/call |
56 | |||||
57 | 86 | 113µs | 86 | 1.09ms | my $potential_scope = $elem->schild($start + 1); # spent 1.09ms making 86 calls to PPI::Node::schild, avg 13µs/call |
58 | 86 | 232µs | 86 | 51µs | return if not $potential_scope; # spent 51µs making 86 calls to PPI::Util::TRUE, avg 590ns/call |
59 | 86 | 328µs | 86 | 134µs | return if $potential_scope->isa('PPI::Structure::List'); # spent 124µs making 83 calls to UNIVERSAL::isa, avg 1µs/call
# spent 10µs making 3 calls to PPI::Structure::List::isa, avg 3µs/call |
60 | |||||
61 | 83 | 302µs | 83 | 1.42ms | return if $potential_scope eq 'my'; # spent 1.42ms making 83 calls to PPI::Element::__eq, avg 17µs/call |
62 | |||||
63 | return $self->violation( $DESC, $EXPL, $elem ); | ||||
64 | } | ||||
65 | |||||
66 | #----------------------------------------------------------------------------- | ||||
67 | |||||
68 | 1 | 4µs | 1; | ||
69 | |||||
70 | __END__ |