← 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/RequireEncodingWithUTF8Layer.pm
StatementsExecuted 27190 statements in 83.4ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1348111112ms151msPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::violatesPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates
14411281┬Ás281┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::applies_toPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::applies_to
61177┬Ás189┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::_recover_open_encodingPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding
62155┬Ás98┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::_get_argument_stringPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_get_argument_string
11116┬Ás16┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@10Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@10
51115┬Ás15┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::CORE:substPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:subst (opcode)
11110┬Ás21┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@11Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@11
1118┬Ás16┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::_recover_binmode_encodingPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_binmode_encoding
1117┬Ás9┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::default_severityPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::default_severity
1117┬Ás11┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@12Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@12
1117┬Ás28┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@14Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@14
1117┬Ás20┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@16Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@16
1117┬Ás62┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@19Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@19
1117┬Ás188┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::BEGIN@18Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@18
1112┬Ás2┬ÁsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::supported_parametersPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::supported_parameters
111300ns300nsPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::CORE:matchPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:match (opcode)
0000s0sPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::::default_themesPerl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::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: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic/lib/Perl/Critic/Policy/InputOutput/RequireEncodingWithUTF8Layer.pm $
3# $Date: 2010-06-22 16:14:07 -0400 (Tue, 22 Jun 2010) $
4# $Author: clonezone $
5# $Revision: 3843 $
6##############################################################################
7
8package Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer;
9
10239┬Ás116┬Ás
# spent 16┬Ás within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@10 which was called: # once (16┬Ás+0s) by Module::Pluggable::Object::_require at line 10
use 5.006001;
11220┬Ás232┬Ás
# spent 21┬Ás (10+11) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@11 which was called: # once (10┬Ás+11┬Ás) by Module::Pluggable::Object::_require at line 11
use strict;
# spent 21┬Ás making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@11 # spent 11┬Ás making 1 call to strict::import
12218┬Ás215┬Ás
# spent 11┬Ás (7+4) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::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::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@12 # spent 4┬Ás making 1 call to warnings::import
13
14219┬Ás249┬Ás
# spent 28┬Ás (7+21) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@14 which was called: # once (7┬Ás+21┬Ás) by Module::Pluggable::Object::_require at line 14
use Readonly;
# spent 28┬Ás making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@14 # spent 21┬Ás making 1 call to Exporter::import
15
16221┬Ás233┬Ás
# spent 20┬Ás (7+13) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@16 which was called: # once (7┬Ás+13┬Ás) by Module::Pluggable::Object::_require at line 16
use version;
# spent 20┬Ás making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@16 # spent 13┬Ás making 1 call to version::import
17
18222┬Ás2369┬Ás
# spent 188┬Ás (7+181) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@18 which was called: # once (7┬Ás+181┬Ás) by Module::Pluggable::Object::_require at line 18
use Perl::Critic::Utils qw{ :severities :ppi };
# spent 188┬Ás making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@18 # spent 181┬Ás making 1 call to Exporter::import
192327┬Ás2116┬Ás
# spent 62┬Ás (7+55) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@19 which was called: # once (7┬Ás+55┬Ás) by Module::Pluggable::Object::_require at line 19
use base 'Perl::Critic::Policy';
# spent 62┬Ás making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::BEGIN@19 # spent 55┬Ás making 1 call to base::import
20
211600nsour $VERSION = '1.121';
22
23#-----------------------------------------------------------------------------
24
2512┬Ás129┬ÁsReadonly::Scalar my $DESC => q{I/O layer ":utf8" used};
# spent 29┬Ás making 1 call to Readonly::Scalar
2611┬Ás121┬ÁsReadonly::Scalar my $EXPL => q{Use ":encoding(UTF-8)" to get strict validation};
# spent 21┬Ás making 1 call to Readonly::Scalar
27
281900ns120┬ÁsReadonly::Scalar my $THREE_ARGUMENT_OPEN => 3;
# spent 20┬Ás making 1 call to Readonly::Scalar
2912┬Ás123┬ÁsReadonly::Hash my %RECOVER_ENCODING => (
# spent 23┬Ás making 1 call to Readonly::Hash
30 binmode => \&_recover_binmode_encoding,
31 open => \&_recover_open_encoding,
32);
33
34#-----------------------------------------------------------------------------
35
3615┬Ás
# spent 2┬Ás within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::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 () }
3712┬Ás
# spent 9┬Ás (7+2) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::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_HIGHEST }
38sub default_themes { return qw(core bugs security) }
39144368┬Ás
# spent 281┬Ás within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::applies_to which was called 144 times, avg 2┬Ás/call: # 144 times (281┬Ás+0s) by Perl::Critic::_critique at line 165 of Perl/Critic.pm, avg 2┬Ás/call
sub applies_to { return 'PPI::Token::Word' }
40
41#-----------------------------------------------------------------------------
42
43
# spent 151ms (112+38.6) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates which was called 13481 times, avg 11┬Ás/call: # 13481 times (112ms+38.6ms) by Perl::Critic::_critique at line 183 of Perl/Critic.pm, avg 11┬Ás/call
sub violates {
44134813.05ms my ($self, $elem, $document) = @_;
45
461348179.4ms2696234.8ms my $handler = $RECOVER_ENCODING{ $elem->content() }
# spent 18.5ms making 13481 calls to Readonly::Hash::FETCH, avg 1┬Ás/call # spent 16.4ms making 13481 calls to PPI::Token::content, avg 1┬Ás/call
47 or return; # If we don't have a handler, we're not interested.
48734┬Ás143.73ms my $encoding = $handler->( parse_arg_list( $elem ) )
# spent 3.52ms making 7 calls to Perl::Critic::Utils::parse_arg_list, avg 503┬Ás/call # spent 189┬Ás making 6 calls to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding, avg 31┬Ás/call # spent 16┬Ás making 1 call to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_binmode_encoding
49 or return; # If we can't recover an encoding, we give up.
5019┬Ás1300ns return if $encoding !~ m/ (?: \A | : ) utf8 \b /smxi; # OK
51
52 return $self->violation( $DESC, $EXPL, $elem );
53}
54
55#-----------------------------------------------------------------------------
56
57# my $string = _get_argument_string( $arg[1] );
58#
59# This subroutine returns the string from the given argument (which must
60# be a reference to an array of PPI objects), _PROVIDED_ the array
61# contains a single PPI::Token::Quote object. Otherwise it simply
62# returns, since we're too stupid to analyze anything else.
63
64
# spent 98┬Ás (55+42) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_get_argument_string which was called 6 times, avg 16┬Ás/call: # 5 times (48┬Ás+41┬Ás) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding at line 95, avg 18┬Ás/call # once (6┬Ás+1┬Ás) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_binmode_encoding at line 81
sub _get_argument_string {
6562┬Ás my ( $arg ) = @_;
6664┬Ás ref $arg eq 'ARRAY' or return;
6765┬Ás return if @{ $arg } == 0 || @{ $arg } > 1;
68647┬Ás1142┬Ás return $arg->[0]->string() if $arg->[0]->isa( 'PPI::Token::Quote' );
# spent 19┬Ás making 1 call to PPI::Token::Quote::Literal::string # spent 18┬Ás making 4 calls to PPI::Token::Quote::Single::string, avg 4┬Ás/call # spent 6┬Ás making 6 calls to UNIVERSAL::isa, avg 917ns/call
6915┬Ás return;
70}
71
72#-----------------------------------------------------------------------------
73
74# my $encoding = _recover_binmode_encoding( _parse_arg_list( $elem ) );
75#
76# This subroutine returns the encoding specified by the given $elem,
77# which _MUST_ be the 'binmode' of a binmode() call.
78
79
# spent 16┬Ás (8+8) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_binmode_encoding which was called: # once (8┬Ás+8┬Ás) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates at line 48
sub _recover_binmode_encoding {
801900ns my ( @args ) = @_;
8115┬Ás18┬Ás return _get_argument_string( $args[1] );
82}
83
84#-----------------------------------------------------------------------------
85
86# my $encoding = _recover_open_encoding( _parse_arg_list( $elem ) );
87#
88# This subroutine returns the encoding specified by the given $elem,
89# which _MUST_ be the 'open' of a open() call.
90
91
# spent 189┬Ás (77+111) within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding which was called 6 times, avg 31┬Ás/call: # 6 times (77┬Ás+111┬Ás) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates at line 48, avg 31┬Ás/call
sub _recover_open_encoding {
9264┬Ás my ( @args ) = @_;
93616┬Ás66┬Ás @args < $THREE_ARGUMENT_OPEN
# spent 6┬Ás making 6 calls to Readonly::Scalar::FETCH, avg 1┬Ás/call
94 and return;
95511┬Ás590┬Ás defined( my $string = _get_argument_string( $args[1] ) )
96 or return;
97531┬Ás515┬Ás $string =~ s/ [+]? (?: < | >{1,2} ) //smx;
# spent 15┬Ás making 5 calls to Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:subst, avg 3┬Ás/call
98515┬Ás return $string;
99}
100
10115┬Ás1;
102
103__END__
 
# spent 300ns within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:match which was called: # once (300ns+0s) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::violates at line 50
sub Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:match; # opcode
# spent 15┬Ás within Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:subst which was called 5 times, avg 3┬Ás/call: # 5 times (15┬Ás+0s) by Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::_recover_open_encoding at line 97, avg 3┬Ás/call
sub Perl::Critic::Policy::InputOutput::RequireEncodingWithUTF8Layer::CORE:subst; # opcode