← 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/ProhibitMatchVars.pm
StatementsExecuted 20 statements in 426µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11116µs16µsPerl::Critic::Policy::Variables::ProhibitMatchVars::::BEGIN@10Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@10
1119µs64µsPerl::Critic::Policy::Variables::ProhibitMatchVars::::BEGIN@16Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@16
1117µs31µsPerl::Critic::Policy::Variables::ProhibitMatchVars::::BEGIN@13Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@13
1117µs18µsPerl::Critic::Policy::Variables::ProhibitMatchVars::::BEGIN@11Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@11
1117µs10µsPerl::Critic::Policy::Variables::ProhibitMatchVars::::BEGIN@12Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@12
1117µs201µsPerl::Critic::Policy::Variables::ProhibitMatchVars::::BEGIN@15Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@15
1116µs7µsPerl::Critic::Policy::Variables::ProhibitMatchVars::::default_severityPerl::Critic::Policy::Variables::ProhibitMatchVars::default_severity
1112µs2µsPerl::Critic::Policy::Variables::ProhibitMatchVars::::supported_parametersPerl::Critic::Policy::Variables::ProhibitMatchVars::supported_parameters
0000s0sPerl::Critic::Policy::Variables::ProhibitMatchVars::::_is_forbidden_varPerl::Critic::Policy::Variables::ProhibitMatchVars::_is_forbidden_var
0000s0sPerl::Critic::Policy::Variables::ProhibitMatchVars::::_is_use_englishPerl::Critic::Policy::Variables::ProhibitMatchVars::_is_use_english
0000s0sPerl::Critic::Policy::Variables::ProhibitMatchVars::::applies_toPerl::Critic::Policy::Variables::ProhibitMatchVars::applies_to
0000s0sPerl::Critic::Policy::Variables::ProhibitMatchVars::::default_themesPerl::Critic::Policy::Variables::ProhibitMatchVars::default_themes
0000s0sPerl::Critic::Policy::Variables::ProhibitMatchVars::::violatesPerl::Critic::Policy::Variables::ProhibitMatchVars::violates
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::ProhibitMatchVars;
9
10238µs116µs
# spent 16µs within Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@10 which was called: # once (16µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11219µs230µs
# spent 18µs (7+11) within Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@11 which was called: # once (7µs+11µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 18µs making 1 call to Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@11 # spent 11µs making 1 call to strict::import
12221µs214µs
# spent 10µs (7+3) within Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@12 which was called: # once (7µs+3µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 10µs making 1 call to Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@12 # spent 4µs making 1 call to warnings::import
13222µs254µs
# spent 31µs (7+24) within Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@13 which was called: # once (7µs+24µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 31µs making 1 call to Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@13 # spent 24µs making 1 call to Exporter::import
14
15224µs2395µs
# spent 201µs (7+194) within Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@15 which was called: # once (7µs+194µs) by Module::Pluggable::Object::_require at line 15
use Perl::Critic::Utils qw{ :severities :data_conversion };
# spent 201µs making 1 call to Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@15 # spent 194µs making 1 call to Exporter::import
162277µs2120µs
# spent 64µs (9+55) within Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@16 which was called: # once (9µs+55µs) by Module::Pluggable::Object::_require at line 16
use base 'Perl::Critic::Policy';
# spent 64µs making 1 call to Perl::Critic::Policy::Variables::ProhibitMatchVars::BEGIN@16 # spent 56µs making 1 call to base::import
17
181600nsour $VERSION = '1.121';
19
20#-----------------------------------------------------------------------------
21
2212µs129µsReadonly::Scalar my $DESC => q{Match variable used};
# spent 29µs making 1 call to Readonly::Scalar
2312µs144µsReadonly::Scalar my $EXPL => [ 82 ];
# spent 44µs making 1 call to Readonly::Scalar
24
2511µs122µsReadonly::Array my @FORBIDDEN => qw( $` $& $' $MATCH $PREMATCH $POSTMATCH );
# spent 22µs making 1 call to Readonly::Array
2617µs358µsReadonly::Hash my %FORBIDDEN => hashify( @FORBIDDEN );
# spent 29µs making 1 call to Readonly::Hash # spent 28µs making 1 call to Perl::Critic::Utils::hashify # spent 1µs making 1 call to Readonly::Array::FETCHSIZE
27
28#-----------------------------------------------------------------------------
29
3014µs
# spent 2µs within Perl::Critic::Policy::Variables::ProhibitMatchVars::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 () }
3111µs
# spent 7µs (6+1) within Perl::Critic::Policy::Variables::ProhibitMatchVars::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_HIGH }
32sub default_themes { return qw( core performance pbp ) }
33sub applies_to { return qw( PPI::Token::Symbol
34 PPI::Statement::Include ) }
35
36#-----------------------------------------------------------------------------
37
38sub violates {
39 my ( $self, $elem, undef ) = @_;
40 if (_is_use_english($elem) || _is_forbidden_var($elem)) {
41 return $self->violation( $DESC, $EXPL, $elem );
42 }
43 return; #ok!
44}
45
46#-----------------------------------------------------------------------------
47
48sub _is_use_english {
49 my $elem = shift;
50 $elem->isa('PPI::Statement::Include') || return;
51 $elem->type() eq 'use' || return;
52 $elem->module() eq 'English' || return;
53
54 # Bare, lacking -no_match_vars. Now handled by
55 # Modules::RequireNoMatchVarsWithUseEnglish.
56 return 0 if ($elem =~ m/\A use \s+ English \s* ;\z/xms);
57
58 return 1 if ($elem =~ m/\$(?:PRE|POST|)MATCH/xms);
59 return; # either "-no_match_vars" or a specific list
60}
61
62sub _is_forbidden_var {
63 my $elem = shift;
64 $elem->isa('PPI::Token::Symbol') || return;
65 return exists $FORBIDDEN{$elem};
66}
67
6816µs1;
69
70__END__