← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:11 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm
StatementsExecuted 2204 statements in 7.44ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
504118.70ms33.5msPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::violatesPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::violates
144112.61ms1.43sPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::prepare_to_scan_documentPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::prepare_to_scan_document
111644┬Ás873┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@14Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@14
14411282┬Ás282┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::applies_toPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::applies_to
11116┬Ás16┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@10Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@10
1117┬Ás188┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@16Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@16
1117┬Ás19┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@11Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@11
1117┬Ás11┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@12Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@12
1117┬Ás27┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@13Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@13
1117┬Ás57┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::BEGIN@17Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@17
1116┬Ás8┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::default_severityPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::default_severity
1112┬Ás2┬ÁsPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::supported_parametersPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::supported_parameters
0000s0sPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::::default_themesPerl::Critic::Policy::Variables::RequireLexicalLoopIterators::default_themes
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1##############################################################################
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6##############################################################################
7
8package Perl::Critic::Policy::Variables::RequireLexicalLoopIterators;
9
10240┬Ás116┬Á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
use 5.006001;
11229┬Ás230┬Á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
use strict;
# spent 19┬Ás making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@11 # spent 12┬Ás making 1 call to strict::import
12218┬Ás214┬Á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
use warnings;
# spent 11┬Ás making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@12 # spent 4┬Ás making 1 call to warnings::import
13219┬Ás247┬Á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
use Readonly;
# spent 27┬Ás making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@13 # spent 20┬Ás making 1 call to Exporter::import
14296┬Ás1873┬Á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
use version ();
15
16224┬Ás2368┬Á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
use Perl::Critic::Utils qw{ :booleans :severities };
# spent 188┬Ás making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@16 # spent 180┬Ás making 1 call to Exporter::import
172217┬Ás2106┬Á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
use base 'Perl::Critic::Policy';
# spent 57┬Ás making 1 call to Perl::Critic::Policy::Variables::RequireLexicalLoopIterators::BEGIN@17 # spent 50┬Ás making 1 call to base::import
18
191600nsour $VERSION = '1.121';
20
21#-----------------------------------------------------------------------------
22
2312┬Ás129┬ÁsReadonly::Scalar my $DESC => q{Loop iterator is not lexical};
# spent 29┬Ás making 1 call to Readonly::Scalar
2412┬Ás142┬ÁsReadonly::Scalar my $EXPL => [ 108 ];
# spent 42┬Ás making 1 call to Readonly::Scalar
25
26112┬Ás227┬ÁsReadonly::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
3015┬Á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
sub supported_parameters { return () }
3112┬Á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
sub default_severity { return $SEVERITY_HIGHEST }
32sub default_themes { return qw(core pbp bugs certrec ) }
33144405┬Á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
sub applies_to { return 'PPI::Statement::Compound' }
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
sub prepare_to_scan_document {
3814457┬Ás my ( $self, $document ) = @_;
39 # perl5004delta says that is when lexical iterators were introduced,
40 # so ... (RT 67760)
41144549┬Ás1441.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
421442.75ms7102.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
sub violates {
48504171┬Ás my ( $self, $elem, undef ) = @_;
49
50 # First child will be 'for' or 'foreach' keyword
515041.40ms50421.4ms return if $elem->type() ne 'foreach';
# spent 21.4ms making 504 calls to PPI::Statement::Compound::type, avg 43┬Ás/call
52
5386116┬Ás86482┬Ás my $first_child = $elem->schild(0);
# spent 482┬Ás making 86 calls to PPI::Node::schild, avg 6┬Ás/call
5486242┬Ás8653┬Ás return if not $first_child;
# spent 53┬Ás making 86 calls to PPI::Util::TRUE, avg 612ns/call
5586306┬Ás8691┬Á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
5786113┬Ás861.09ms my $potential_scope = $elem->schild($start + 1);
# spent 1.09ms making 86 calls to PPI::Node::schild, avg 13┬Ás/call
5886232┬Ás8651┬Ás return if not $potential_scope;
# spent 51┬Ás making 86 calls to PPI::Util::TRUE, avg 590ns/call
5986328┬Ás86134┬Á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
6183302┬Ás831.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
6814┬Ás1;
69
70__END__