← 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/Objects/ProhibitIndirectSyntax.pm
StatementsExecuted 24 statements in 428µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11119µs19µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::BEGIN@10Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@10
1118µs26µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::BEGIN@17Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@17
1118µs11µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::BEGIN@12Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@12
1118µs398µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::BEGIN@16Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@16
1117µs374µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::BEGIN@15Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@15
1117µs37µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::BEGIN@14Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@14
1117µs60µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::BEGIN@19Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@19
1117µs17µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::BEGIN@11Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@11
1116µs7µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::default_severityPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::default_severity
1116µs6µsPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::supported_parametersPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::supported_parameters
0000s0sPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::applies_toPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::applies_to
0000s0sPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::default_themesPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::default_themes
0000s0sPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::::violatesPerl::Critic::Policy::Objects::ProhibitIndirectSyntax::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::Objects::ProhibitIndirectSyntax;
9
10238µs119µs
# spent 19µs within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@10 which was called: # once (19µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11220µs228µs
# spent 17µs (7+10) within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@11 which was called: # once (7µs+10µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 17µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@11 # spent 10µs making 1 call to strict::import
12218µs215µs
# spent 11µs (8+4) within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@12 which was called: # once (8µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 11µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@12 # spent 4µs making 1 call to warnings::import
13
14221µs266µs
# spent 37µs (7+30) within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@14 which was called: # once (7µs+30µs) by Module::Pluggable::Object::_require at line 14
use Carp;
# spent 37µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@14 # spent 30µs making 1 call to Exporter::import
15225µs2741µs
# spent 374µs (7+367) within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@15 which was called: # once (7µs+367µs) by Module::Pluggable::Object::_require at line 15
use English qw(-no_match_vars);
# spent 374µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@15 # spent 367µs making 1 call to English::import
16222µs2789µs
# spent 398µs (8+391) within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@16 which was called: # once (8µs+391µs) by Module::Pluggable::Object::_require at line 16
use Perl::Critic::Utils qw{ :severities :classification };
# spent 398µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@16 # spent 391µs making 1 call to Exporter::import
17221µs245µs
# spent 26µs (8+18) within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@17 which was called: # once (8µs+18µs) by Module::Pluggable::Object::_require at line 17
use Readonly;
# spent 26µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@17 # spent 18µs making 1 call to Exporter::import
18
192243µs2112µs
# spent 60µs (7+52) within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@19 which was called: # once (7µs+52µs) by Module::Pluggable::Object::_require at line 19
use base 'Perl::Critic::Policy';
# spent 60µs making 1 call to Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::BEGIN@19 # spent 52µs making 1 call to base::import
20
211600nsour $VERSION = '1.121';
22
23#-----------------------------------------------------------------------------
24
2514µs131µsReadonly::Hash my %COMMA => {
# spent 31µs making 1 call to Readonly::Hash
26 q<,> => 1,
27 q{=>} => 1,
28};
2911µs122µsReadonly::Scalar my $DOLLAR => q<$>;
# spent 22µs making 1 call to Readonly::Scalar
30
311900ns120µsReadonly::Scalar my $DESC => 'Subroutine "%s" called using indirect syntax';
# spent 20µs making 1 call to Readonly::Scalar
3212µs140µsReadonly::Scalar my $EXPL => [ 349 ];
# spent 40µs making 1 call to Readonly::Scalar
33
34#-----------------------------------------------------------------------------
35
36
# spent 6µs within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::supported_parameters which was called: # once (6µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm
sub supported_parameters {
37 return (
38 {
3918µs name => 'forbid',
40 description => 'Indirect method syntax is forbidden for these methods.',
41 behavior => 'string list',
42 list_always_present_values => [ qw{ new } ],
43 }
44 )
45}
46
4712µs
# spent 7µs (6+1) within Perl::Critic::Policy::Objects::ProhibitIndirectSyntax::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 }
48sub default_themes { return qw( core pbp maintenance certrule ) }
49sub applies_to { return 'PPI::Token::Word' }
50
51#-----------------------------------------------------------------------------
52
53sub violates {
54 my ( $self, $elem, $doc ) = @_;
55
56 # We are only interested in the functions we have been told to check.
57 # Do this before calling is_function_call() because we want to weed
58 # out as many candidate tokens as possible before calling it.
59 return if not $self->{_forbid}->{$elem->content()};
60
61 # Make sure it really is a function call.
62 return if not is_function_call($elem);
63
64 # Per perlobj, it is only an indirect object call if the next sibling
65 # is a word, a scalar symbol, or a block.
66 my $object = $elem->snext_sibling() or return;
67 return if not (
68 $object->isa( 'PPI::Token::Word' )
69 or $object->isa( 'PPI::Token::Symbol' )
70 and $DOLLAR eq $object->raw_type()
71 or $object->isa( 'PPI::Structure::Block' )
72 );
73
74 # Per perlobj, it is not an indirect object call if the operator after
75 # the possible indirect object is a comma.
76 if ( my $operator = $object->snext_sibling() ) {
77 return if
78 $operator->isa( 'PPI::Token::Operator' )
79 and $COMMA{ $operator->content() };
80 }
81
82 my $message = sprintf $DESC, $elem->content();
83
84 return $self->violation( $message, $EXPL, $elem );
85}
86
8714µs1;
88
89__END__