← 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:12 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/InputOutput/RequireBracedFileHandleWithPrint.pm
StatementsExecuted 21 statements in 491µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11119µs19µsPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::BEGIN@10Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@10
11112µs35µsPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::BEGIN@13Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@13
1118µs21µsPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::BEGIN@11Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@11
1118µs3.65msPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::BEGIN@15Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@15
1118µs12µsPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::BEGIN@12Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@12
1118µs58µsPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::BEGIN@16Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@16
1117µs9µsPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::default_severityPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::default_severity
1112µs2µsPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::supported_parametersPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::supported_parameters
1111µs1µsPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::CORE:qrPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::CORE:qr (opcode)
0000s0sPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::applies_toPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::applies_to
0000s0sPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::default_themesPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::default_themes
0000s0sPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::::violatesPerl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::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::InputOutput::RequireBracedFileHandleWithPrint;
9
10244µs119µs
# spent 19µs within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@10 which was called: # once (19µs+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11222µs234µs
# spent 21µs (8+13) within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@11 which was called: # once (8µs+13µs) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 21µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@11 # spent 13µs making 1 call to strict::import
12220µs217µs
# spent 12µs (8+4) within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@12 which was called: # once (8µs+4µs) by Module::Pluggable::Object::_require at line 12
use warnings;
# spent 12µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@12 # spent 4µs making 1 call to warnings::import
13226µs258µs
# spent 35µs (12+23) within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@13 which was called: # once (12µs+23µs) by Module::Pluggable::Object::_require at line 13
use Readonly;
# spent 35µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@13 # spent 23µs making 1 call to Exporter::import
14
15226µs27.28ms
# spent 3.65ms (8µs+3.64) within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@15 which was called: # once (8µs+3.64ms) by Module::Pluggable::Object::_require at line 15
use Perl::Critic::Utils qw{ :severities :classification :data_conversion };
# spent 3.65ms making 1 call to Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@15 # spent 3.64ms making 1 call to Exporter::import
162322µs2109µs
# spent 58µs (8+50) within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@16 which was called: # once (8µs+50µs) by Module::Pluggable::Object::_require at line 16
use base 'Perl::Critic::Policy';
# spent 58µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::BEGIN@16 # spent 50µs making 1 call to base::import
17
181500nsour $VERSION = '1.121';
19
20#-----------------------------------------------------------------------------
21
2212µs126µsReadonly::Array my @POSTFIX_WORDS => qw( if unless for );
# spent 26µs making 1 call to Readonly::Array
2317µs347µsReadonly::Hash my %POSTFIX_WORDS => hashify( @POSTFIX_WORDS );
# spent 29µs making 1 call to Readonly::Hash # spent 16µs making 1 call to Perl::Critic::Utils::hashify # spent 1µs making 1 call to Readonly::Array::FETCHSIZE
2417µs225µsReadonly::Scalar my $PRINT_RX => qr/ \A (?: print f? | say ) \z /xms;
# spent 23µs making 1 call to Readonly::Scalar # spent 1µs making 1 call to Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::CORE:qr
25
2611µs120µsReadonly::Scalar my $DESC => q{File handle for "print" or "printf" is not braced};
# spent 20µs making 1 call to Readonly::Scalar
2711µs140µsReadonly::Scalar my $EXPL => [ 217 ];
# spent 40µs making 1 call to Readonly::Scalar
28
29#-----------------------------------------------------------------------------
30
3114µs
# spent 2µs within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::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 () }
3212µs
# spent 9µs (7+2) within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::default_severity which was called: # once (7µs+2µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm
sub default_severity { return $SEVERITY_LOWEST }
33sub default_themes { return qw( core pbp cosmetic ) }
34sub applies_to { return 'PPI::Token::Word' }
35
36#-----------------------------------------------------------------------------
37
38sub violates {
39 my ( $self, $elem, undef ) = @_;
40
41 return if $elem !~ $PRINT_RX;
42 return if ! is_function_call($elem);
43
44 my @sib;
45
46 $sib[0] = $elem->snext_sibling();
47 return if !$sib[0];
48
49 # Deal with situations where 'print' is called with parentheses
50 if ( $sib[0]->isa('PPI::Structure::List') ) {
51 my $expr = $sib[0]->schild(0);
52 return if !$expr;
53 $sib[0] = $expr->schild(0);
54 return if !$sib[0];
55 }
56
57 $sib[1] = $sib[0]->next_sibling();
58 return if !$sib[1];
59 $sib[2] = $sib[1]->next_sibling();
60 return if !$sib[2];
61
62 # First token must be a scalar symbol or bareword;
63 return if !( ($sib[0]->isa('PPI::Token::Symbol') && $sib[0] =~ m/\A \$/xms)
64 || $sib[0]->isa('PPI::Token::Word') );
65
66 # First token must not be a builtin function or control
67 return if is_perl_builtin($sib[0]);
68 return if exists $POSTFIX_WORDS{ $sib[0] };
69
70 # Second token must be white space
71 return if !$sib[1]->isa('PPI::Token::Whitespace');
72
73 # Third token must not be an operator
74 return if $sib[2]->isa('PPI::Token::Operator');
75
76 # Special case for postfix controls
77 return if exists $POSTFIX_WORDS{ $sib[2] };
78
79 return if $sib[0]->isa('PPI::Structure::Block');
80
81 return $self->violation( $DESC, $EXPL, $elem );
82}
83
8416µs1;
85
86__END__
 
# spent 1µs within Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::CORE:qr which was called: # once (1µs+0s) by Module::Pluggable::Object::_require at line 24
sub Perl::Critic::Policy::InputOutput::RequireBracedFileHandleWithPrint::CORE:qr; # opcode