← 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/PolicyFactory.pm
StatementsExecuted 4843 statements in 11.0ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
141113.83ms347msPerl::Critic::PolicyFactory::::_instantiate_policyPerl::Critic::PolicyFactory::_instantiate_policy
141112.16ms361msPerl::Critic::PolicyFactory::::create_policyPerl::Critic::PolicyFactory::create_policy
53321.38ms2.15msPerl::Critic::PolicyFactory::::site_policy_namesPerl::Critic::PolicyFactory::site_policy_names
1111.38ms379msPerl::Critic::PolicyFactory::::create_all_policiesPerl::Critic::PolicyFactory::create_all_policies
1111.15ms5.46msPerl::Critic::PolicyFactory::::BEGIN@27Perl::Critic::PolicyFactory::BEGIN@27
28221994┬Ás12.4msPerl::Critic::PolicyFactory::::_handle_policy_instantiation_exceptionPerl::Critic::PolicyFactory::_handle_policy_instantiation_exception
5311769┬Ás769┬ÁsPerl::Critic::PolicyFactory::::CORE:sortPerl::Critic::PolicyFactory::CORE:sort (opcode)
222719┬Ás1.30sPerl::Critic::PolicyFactory::::importPerl::Critic::PolicyFactory::import
111330┬Ás748┬ÁsPerl::Critic::PolicyFactory::::BEGIN@34Perl::Critic::PolicyFactory::BEGIN@34
111296┬Ás718┬ÁsPerl::Critic::PolicyFactory::::BEGIN@33Perl::Critic::PolicyFactory::BEGIN@33
14221204┬Ás204┬ÁsPerl::Critic::PolicyFactory::::_profilePerl::Critic::PolicyFactory::_profile
11154┬Ás129┬ÁsPerl::Critic::PolicyFactory::::_validate_policies_in_profilePerl::Critic::PolicyFactory::_validate_policies_in_profile
11139┬Ás177┬ÁsPerl::Critic::PolicyFactory::::_initPerl::Critic::PolicyFactory::_init
11114┬Ás14┬ÁsPerl::Critic::PolicyFactory::::BEGIN@10Perl::Critic::PolicyFactory::BEGIN@10
11114┬Ás34┬ÁsPerl::Critic::PolicyFactory::::BEGIN@29Perl::Critic::PolicyFactory::BEGIN@29
11112┬Ás30┬ÁsPerl::Critic::PolicyFactory::::BEGIN@28Perl::Critic::PolicyFactory::BEGIN@28
11111┬Ás37┬ÁsPerl::Critic::PolicyFactory::::BEGIN@30Perl::Critic::PolicyFactory::BEGIN@30
11111┬Ás188┬ÁsPerl::Critic::PolicyFactory::::newPerl::Critic::PolicyFactory::new
1119┬Ás144┬ÁsPerl::Critic::PolicyFactory::::BEGIN@35Perl::Critic::PolicyFactory::BEGIN@35
1119┬Ás20┬ÁsPerl::Critic::PolicyFactory::::BEGIN@37Perl::Critic::PolicyFactory::BEGIN@37
1119┬Ás35┬ÁsPerl::Critic::PolicyFactory::::BEGIN@31Perl::Critic::PolicyFactory::BEGIN@31
1117┬Ás364┬ÁsPerl::Critic::PolicyFactory::::BEGIN@19Perl::Critic::PolicyFactory::BEGIN@19
1116┬Ás10┬ÁsPerl::Critic::PolicyFactory::::BEGIN@12Perl::Critic::PolicyFactory::BEGIN@12
1116┬Ás137┬ÁsPerl::Critic::PolicyFactory::::BEGIN@17Perl::Critic::PolicyFactory::BEGIN@17
1116┬Ás17┬ÁsPerl::Critic::PolicyFactory::::BEGIN@11Perl::Critic::PolicyFactory::BEGIN@11
1116┬Ás355┬ÁsPerl::Critic::PolicyFactory::::BEGIN@14Perl::Critic::PolicyFactory::BEGIN@14
1114┬Ás4┬ÁsPerl::Critic::PolicyFactory::::BEGIN@16Perl::Critic::PolicyFactory::BEGIN@16
0000s0sPerl::Critic::PolicyFactory::::__ANON__[:87]Perl::Critic::PolicyFactory::__ANON__[:87]
0000s0sPerl::Critic::PolicyFactory::::_module2pathPerl::Critic::PolicyFactory::_module2path
0000s0sPerl::Critic::PolicyFactory::::_modules_from_blibPerl::Critic::PolicyFactory::_modules_from_blib
0000s0sPerl::Critic::PolicyFactory::::_was_loaded_from_blibPerl::Critic::PolicyFactory::_was_loaded_from_blib
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::PolicyFactory;
9
10235┬Ás114┬Ás
# spent 14┬Ás within Perl::Critic::PolicyFactory::BEGIN@10 which was called: # once (14┬Ás+0s) by Perl::Critic::Config::BEGIN@24 at line 10
use 5.006001;
# spent 14┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@10
11217┬Ás228┬Ás
# spent 17┬Ás (6+11) within Perl::Critic::PolicyFactory::BEGIN@11 which was called: # once (6┬Ás+11┬Ás) by Perl::Critic::Config::BEGIN@24 at line 11
use strict;
# spent 17┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@11 # spent 11┬Ás making 1 call to strict::import
12219┬Ás214┬Ás
# spent 10┬Ás (6+4) within Perl::Critic::PolicyFactory::BEGIN@12 which was called: # once (6┬Ás+4┬Ás) by Perl::Critic::Config::BEGIN@24 at line 12
use warnings;
# spent 10┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@12 # spent 4┬Ás making 1 call to warnings::import
13
14222┬Ás2703┬Ás
# spent 355┬Ás (6+348) within Perl::Critic::PolicyFactory::BEGIN@14 which was called: # once (6┬Ás+348┬Ás) by Perl::Critic::Config::BEGIN@24 at line 14
use English qw(-no_match_vars);
# spent 355┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@14 # spent 348┬Ás making 1 call to English::import
15
16218┬Ás14┬Ás
# spent 4┬Ás within Perl::Critic::PolicyFactory::BEGIN@16 which was called: # once (4┬Ás+0s) by Perl::Critic::Config::BEGIN@24 at line 16
use File::Spec::Unix qw();
# spent 4┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@16
17228┬Ás2268┬Ás
# spent 137┬Ás (6+131) within Perl::Critic::PolicyFactory::BEGIN@17 which was called: # once (6┬Ás+131┬Ás) by Perl::Critic::Config::BEGIN@24 at line 17
use List::MoreUtils qw(any);
# spent 137┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@17 # spent 131┬Ás making 1 call to Exporter::Tiny::import
18
191200ns
# spent 364┬Ás (7+357) within Perl::Critic::PolicyFactory::BEGIN@19 which was called: # once (7┬Ás+357┬Ás) by Perl::Critic::Config::BEGIN@24 at line 26
use Perl::Critic::Utils qw{
20 :characters
21 $POLICY_NAMESPACE
22 :data_conversion
23 policy_long_name
24 policy_short_name
25 :internal_lookup
26121┬Ás2720┬Ás};
# spent 364┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@19 # spent 357┬Ás making 1 call to Exporter::import
272108┬Ás15.46ms
# spent 5.46ms (1.15+4.31) within Perl::Critic::PolicyFactory::BEGIN@27 which was called: # once (1.15ms+4.31ms) by Perl::Critic::Config::BEGIN@24 at line 27
use Perl::Critic::PolicyConfig;
# spent 5.46ms making 1 call to Perl::Critic::PolicyFactory::BEGIN@27
28233┬Ás249┬Ás
# spent 30┬Ás (12+19) within Perl::Critic::PolicyFactory::BEGIN@28 which was called: # once (12┬Ás+19┬Ás) by Perl::Critic::Config::BEGIN@24 at line 28
use Perl::Critic::Exception::AggregateConfiguration;
# spent 30┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@28 # spent 19┬Ás making 1 call to Exporter::import
29230┬Ás254┬Ás
# spent 34┬Ás (14+20) within Perl::Critic::PolicyFactory::BEGIN@29 which was called: # once (14┬Ás+20┬Ás) by Perl::Critic::Config::BEGIN@24 at line 29
use Perl::Critic::Exception::Configuration;
# spent 34┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@29 # spent 20┬Ás making 1 call to Exporter::import
30236┬Ás264┬Ás
# spent 37┬Ás (11+26) within Perl::Critic::PolicyFactory::BEGIN@30 which was called: # once (11┬Ás+26┬Ás) by Perl::Critic::Config::BEGIN@24 at line 30
use Perl::Critic::Exception::Fatal::Generic qw{ throw_generic };
# spent 37┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@30 # spent 26┬Ás making 1 call to Exporter::import
31228┬Ás260┬Ás
# spent 35┬Ás (9+26) within Perl::Critic::PolicyFactory::BEGIN@31 which was called: # once (9┬Ás+26┬Ás) by Perl::Critic::Config::BEGIN@24 at line 31
use Perl::Critic::Exception::Fatal::Internal qw{ throw_internal };
# spent 35┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@31 # spent 26┬Ás making 1 call to Exporter::import
32use Perl::Critic::Exception::Fatal::PolicyDefinition
332129┬Ás2767┬Ás
# spent 718┬Ás (296+422) within Perl::Critic::PolicyFactory::BEGIN@33 which was called: # once (296┬Ás+422┬Ás) by Perl::Critic::Config::BEGIN@24 at line 33
qw{ throw_policy_definition };
# spent 718┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@33 # spent 50┬Ás making 1 call to Exporter::import
342117┬Ás1748┬Ás
# spent 748┬Ás (330+418) within Perl::Critic::PolicyFactory::BEGIN@34 which was called: # once (330┬Ás+418┬Ás) by Perl::Critic::Config::BEGIN@24 at line 34
use Perl::Critic::Exception::Configuration::NonExistentPolicy qw< >;
# spent 748┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@34
35230┬Ás2280┬Ás
# spent 144┬Ás (9+135) within Perl::Critic::PolicyFactory::BEGIN@35 which was called: # once (9┬Ás+135┬Ás) by Perl::Critic::Config::BEGIN@24 at line 35
use Perl::Critic::Utils::Constants qw{ :profile_strictness };
# spent 144┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@35 # spent 135┬Ás making 1 call to Exporter::import
36
3721.25ms231┬Ás
# spent 20┬Ás (9+11) within Perl::Critic::PolicyFactory::BEGIN@37 which was called: # once (9┬Ás+11┬Ás) by Perl::Critic::Config::BEGIN@24 at line 37
use Exception::Class; # this must come after "use P::C::Exception::*"
# spent 20┬Ás making 1 call to Perl::Critic::PolicyFactory::BEGIN@37 # spent 11┬Ás making 1 call to Exception::Class::import
38
391900nsour $VERSION = '1.121';
40
41#-----------------------------------------------------------------------------
42
43# Globals. Ick!
441700nsmy @site_policy_names = ();
45
46#-----------------------------------------------------------------------------
47
48# Blech!!! This is ug-lee. Belongs in the constructor. And it shouldn't be
49# called "test" mode.
50
# spent 1.30s (719┬Ás+1.30) within Perl::Critic::PolicyFactory::import which was called 2 times, avg 652ms/call: # once (714┬Ás+1.30s) by Perl::Critic::Config::BEGIN@24 at line 24 of Perl/Critic/Config.pm # once (6┬Ás+0s) by Perl::Critic::Annotation::BEGIN@17 at line 17 of Perl/Critic/Annotation.pm
sub import {
51
5222┬Ás my ( $class, %args ) = @_;
5322┬Ás my $test_mode = $args{-test};
542700ns my $extra_test_policies = $args{'-extra-test-policies'};
55
5621┬Ás if ( not @site_policy_names ) {
571600ns my $eval_worked = eval {
58184┬Ás require Module::Pluggable;
5913┬Ás138┬Ás Module::Pluggable->import(search_path => $POLICY_NAMESPACE,
# spent 38┬Ás making 1 call to Module::Pluggable::import
60 require => 1, inner => 0);
61110┬Ás11.29s @site_policy_names = plugins(); #Exported by Module::Pluggable
621800ns 1;
63 };
64
651300ns if (not $eval_worked) {
66 if ( $EVAL_ERROR ) {
67 throw_generic
68 qq<Can't load Policies from namespace "$POLICY_NAMESPACE": $EVAL_ERROR>;
69 }
70
71 throw_generic
72 qq<Can't load Policies from namespace "$POLICY_NAMESPACE" for an unknown reason.>;
73 }
74
751400ns if ( not @site_policy_names ) {
76 throw_generic
77 qq<No Policies found in namespace "$POLICY_NAMESPACE".>;
78 }
79 }
80
81 # In test mode, only load native policies, not third-party ones. So this
82 # filters out any policy that was loaded from within a directory called
83 # "blib". During the usual "./Build test" process this works fine,
84 # but it doesn't work if you are using prove to test against the code
85 # directly in the lib/ directory.
86
872600ns if ( $test_mode && any {m/\b blib \b/xms} @INC ) {
88 @site_policy_names = _modules_from_blib( @site_policy_names );
89
90 if ($extra_test_policies) {
91 my @extra_policy_full_names =
92 map { "${POLICY_NAMESPACE}::$_" } @{$extra_test_policies};
93
94 push @site_policy_names, @extra_policy_full_names;
95 }
96 }
97
9829┬Ás return 1;
99}
100
101#-----------------------------------------------------------------------------
102# Some static helper subs
103
104sub _modules_from_blib {
105 my (@modules) = @_;
106 return grep { _was_loaded_from_blib( _module2path($_) ) } @modules;
107}
108
109sub _module2path {
110 my $module = shift || return;
111 return File::Spec::Unix->catdir(split m/::/xms, $module) . '.pm';
112}
113
114sub _was_loaded_from_blib {
115 my $path = shift || return;
116 my $full_path = $INC{$path};
117 return $full_path && $full_path =~ m/ (?: \A | \b b ) lib \b /xms;
118}
119
120#-----------------------------------------------------------------------------
121
122
# spent 188┬Ás (11+177) within Perl::Critic::PolicyFactory::new which was called: # once (11┬Ás+177┬Ás) by Perl::Critic::Config::_init at line 137 of Perl/Critic/Config.pm
sub new {
123
12412┬Ás my ( $class, %args ) = @_;
12512┬Ás my $self = bless {}, $class;
12613┬Ás1177┬Ás $self->_init( %args );
# spent 177┬Ás making 1 call to Perl::Critic::PolicyFactory::_init
12713┬Ás return $self;
128}
129
130#-----------------------------------------------------------------------------
131
132
# spent 177┬Ás (39+138) within Perl::Critic::PolicyFactory::_init which was called: # once (39┬Ás+138┬Ás) by Perl::Critic::PolicyFactory::new at line 126
sub _init {
133
13414┬Ás my ($self, %args) = @_;
135
1361900ns my $profile = $args{-profile};
13713┬Ás $self->{_profile} = $profile
138 or throw_internal q{The -profile argument is required};
139
1401600ns my $incoming_errors = $args{-errors};
1411400ns my $profile_strictness = $args{'-profile-strictness'};
1421200ns $profile_strictness ||= $PROFILE_STRICTNESS_DEFAULT;
1431700ns $self->{_profile_strictness} = $profile_strictness;
144
14513┬Ás11┬Ás if ( $profile_strictness ne $PROFILE_STRICTNESS_QUIET ) {
# spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
1461100ns my $errors;
147
148 # If we're supposed to be strict or problems have already been found...
14918┬Ás37┬Ás if (
# spent 3┬Ás making 1 call to Perl::Critic::Exception::AggregateConfiguration::exceptions # spent 3┬Ás making 1 call to Exception::Class::Base::__ANON__[Exception/Class/Base.pm:32] # spent 1┬Ás making 1 call to Readonly::Scalar::FETCH
150 $profile_strictness eq $PROFILE_STRICTNESS_FATAL
151 or ( $incoming_errors and @{ $incoming_errors->exceptions() } )
152 ) {
153 $errors =
154 $incoming_errors
155 ? $incoming_errors
156 : Perl::Critic::Exception::AggregateConfiguration->new();
157 }
158
15912┬Ás1129┬Ás $self->_validate_policies_in_profile( $errors );
160
16112┬Ás11┬Ás if (
162 not $incoming_errors
163 and $errors
164 and $errors->has_exceptions()
165 ) {
166 $errors->rethrow();
167 }
168 }
169
17014┬Ás return $self;
171}
172
173#-----------------------------------------------------------------------------
174
175
# spent 361ms (2.16+359) within Perl::Critic::PolicyFactory::create_policy which was called 141 times, avg 2.56ms/call: # 141 times (2.16ms+359ms) by Perl::Critic::PolicyFactory::create_all_policies at line 220, avg 2.56ms/call
sub create_policy {
176
177141121┬Ás my ($self, %args ) = @_;
178
17914170┬Ás my $policy_name = $args{-name}
180 or throw_internal q{The -name argument is required};
181
182 # Normalize policy name to a fully-qualified package name
183141171┬Ás1411.73ms $policy_name = policy_long_name( $policy_name );
# spent 1.73ms making 141 calls to Perl::Critic::Utils::policy_long_name, avg 12┬Ás/call
184141190┬Ás1411.56ms my $policy_short_name = policy_short_name( $policy_name );
# spent 1.56ms making 141 calls to Perl::Critic::Utils::policy_short_name, avg 11┬Ás/call
185
186
187 # Get the policy parameters from the user profile if they were
188 # not given to us directly. If none exist, use an empty hash.
189141180┬Ás141201┬Ás my $profile = $self->_profile();
# spent 201┬Ás making 141 calls to Perl::Critic::PolicyFactory::_profile, avg 1┬Ás/call
19014113┬Ás my $policy_config;
19114160┬Ás if ( $args{-params} ) {
192 $policy_config =
193 Perl::Critic::PolicyConfig->new(
194 $policy_short_name, $args{-params}
195 );
196 }
197 else {
198141232┬Ás1418.91ms $policy_config = $profile->policy_params($policy_name);
# spent 8.91ms making 141 calls to Perl::Critic::UserProfile::policy_params, avg 63┬Ás/call
19914133┬Ás $policy_config ||=
200 Perl::Critic::PolicyConfig->new( $policy_short_name );
201 }
202
203 # Pull out base parameters.
204141459┬Ás141347ms return $self->_instantiate_policy( $policy_name, $policy_config );
# spent 347ms making 141 calls to Perl::Critic::PolicyFactory::_instantiate_policy, avg 2.46ms/call
205}
206
207#-----------------------------------------------------------------------------
208
209
# spent 379ms (1.38+378) within Perl::Critic::PolicyFactory::create_all_policies which was called: # once (1.38ms+378ms) by Perl::Critic::Config::_load_policies at line 219 of Perl/Critic/Config.pm
sub create_all_policies {
210
2111400ns my ( $self, $incoming_errors ) = @_;
212
21312┬Ás1800ns my $errors =
214 $incoming_errors
215 ? $incoming_errors
216 : Perl::Critic::Exception::AggregateConfiguration->new();
2171200ns my @policies;
218
219112┬Ás122┬Ás foreach my $name ( site_policy_names() ) {
# spent 22┬Ás making 1 call to Perl::Critic::PolicyFactory::site_policy_names
220282301┬Ás141361ms my $policy = eval { $self->create_policy( -name => $name ) };
# spent 361ms making 141 calls to Perl::Critic::PolicyFactory::create_policy, avg 2.56ms/call
221
222141151┬Ás141186┬Ás $errors->add_exception_or_rethrow( $EVAL_ERROR );
# spent 186┬Ás making 141 calls to Perl::Critic::Exception::AggregateConfiguration::add_exception_or_rethrow, avg 1┬Ás/call
223
224141421┬Ás14116.5ms if ( $policy ) {
# spent 16.5ms making 141 calls to Perl::Critic::Policy::to_string, avg 117┬Ás/call
225 push @policies, $policy;
226 }
227 }
228
22913┬Ás12┬Ás if ( not $incoming_errors and $errors->has_exceptions() ) {
230 $errors->rethrow();
231 }
232
233117┬Ás return @policies;
234}
235
236#-----------------------------------------------------------------------------
237
238
# spent 2.15ms (1.38+769┬Ás) within Perl::Critic::PolicyFactory::site_policy_names which was called 53 times, avg 41┬Ás/call: # 51 times (1.34ms+748┬Ás) by Perl::Critic::Annotation::_parse_annotation at line 255 of Perl/Critic/Annotation.pm, avg 41┬Ás/call # once (25┬Ás+15┬Ás) by Perl::Critic::PolicyFactory::_validate_policies_in_profile at line 305 # once (16┬Ás+6┬Ás) by Perl::Critic::PolicyFactory::create_all_policies at line 219
sub site_policy_names {
239531.45ms53769┬Ás my @sorted_policy_names = sort @site_policy_names;
# spent 769┬Ás making 53 calls to Perl::Critic::PolicyFactory::CORE:sort, avg 15┬Ás/call
24053722┬Ás return @sorted_policy_names;
241}
242
243#-----------------------------------------------------------------------------
244
245
# spent 204┬Ás within Perl::Critic::PolicyFactory::_profile which was called 142 times, avg 1┬Ás/call: # 141 times (201┬Ás+0s) by Perl::Critic::PolicyFactory::create_policy at line 189, avg 1┬Ás/call # once (2┬Ás+0s) by Perl::Critic::PolicyFactory::_validate_policies_in_profile at line 304
sub _profile {
24614229┬Ás my ($self) = @_;
247
248142312┬Ás return $self->{_profile};
249}
250
251#-----------------------------------------------------------------------------
252
253# This two-phase initialization is caused by the historical lack of a
254# requirement for Policies to invoke their super-constructor.
255
# spent 347ms (3.83+343) within Perl::Critic::PolicyFactory::_instantiate_policy which was called 141 times, avg 2.46ms/call: # 141 times (3.83ms+343ms) by Perl::Critic::PolicyFactory::create_policy at line 204, avg 2.46ms/call
sub _instantiate_policy {
25614144┬Ás my ($self, $policy_name, $policy_config) = @_;
257
258141135┬Ás141816┬Ás $policy_config->set_profile_strictness( $self->{_profile_strictness} );
# spent 816┬Ás making 141 calls to Perl::Critic::PolicyConfig::set_profile_strictness, avg 6┬Ás/call
259
2602821.32ms141227ms my $policy = eval { $policy_name->new( %{$policy_config} ) };
# spent 227ms making 141 calls to Perl::Critic::Policy::new, avg 1.61ms/call
261141196┬Ás14112.1ms _handle_policy_instantiation_exception(
# spent 12.1ms making 141 calls to Perl::Critic::PolicyFactory::_handle_policy_instantiation_exception, avg 86┬Ás/call
262 $policy_name,
263 $policy, # Note: being used as a boolean here.
264 $EVAL_ERROR,
265 );
266
267141187┬Ás141447┬Ás $policy->__set_config( $policy_config );
# spent 447┬Ás making 141 calls to Perl::Critic::Policy::__set_config, avg 3┬Ás/call
268
269423589┬Ás141102ms my $eval_worked = eval { $policy->__set_base_parameters(); 1; };
# spent 102ms making 141 calls to Perl::Critic::Policy::__set_base_parameters, avg 726┬Ás/call
270141182┬Ás141275┬Ás _handle_policy_instantiation_exception(
# spent 275┬Ás making 141 calls to Perl::Critic::PolicyFactory::_handle_policy_instantiation_exception, avg 2┬Ás/call
271 $policy_name, $eval_worked, $EVAL_ERROR,
272 );
273
274141286┬Ás return $policy;
275}
276
277
# spent 12.4ms (994┬Ás+11.4) within Perl::Critic::PolicyFactory::_handle_policy_instantiation_exception which was called 282 times, avg 44┬Ás/call: # 141 times (719┬Ás+11.4ms) by Perl::Critic::PolicyFactory::_instantiate_policy at line 261, avg 86┬Ás/call # 141 times (275┬Ás+0s) by Perl::Critic::PolicyFactory::_instantiate_policy at line 270, avg 2┬Ás/call
sub _handle_policy_instantiation_exception {
278282125┬Ás my ($policy_name, $eval_worked, $eval_error) = @_;
279
280282316┬Ás14111.4ms if (not $eval_worked) {
# spent 11.4ms making 141 calls to Perl::Critic::Policy::to_string, avg 81┬Ás/call
281 if ($eval_error) {
282 my $exception = Exception::Class->caught();
283
284 if (ref $exception) {
285 $exception->rethrow();
286 }
287
288 throw_policy_definition
289 qq<Unable to create policy "$policy_name": $eval_error>;
290 }
291
292 throw_policy_definition
293 qq<Unable to create policy "$policy_name" for an unknown reason.>;
294 }
295
296282566┬Ás return;
297}
298
299#-----------------------------------------------------------------------------
300
301
# spent 129┬Ás (54+74) within Perl::Critic::PolicyFactory::_validate_policies_in_profile which was called: # once (54┬Ás+74┬Ás) by Perl::Critic::PolicyFactory::_init at line 159
sub _validate_policies_in_profile {
3021400ns my ($self, $errors) = @_;
303
30412┬Ás12┬Ás my $profile = $self->_profile();
# spent 2┬Ás making 1 call to Perl::Critic::PolicyFactory::_profile
305134┬Ás261┬Ás my %known_policies = hashify( $self->site_policy_names() );
# spent 39┬Ás making 1 call to Perl::Critic::PolicyFactory::site_policy_names # spent 22┬Ás making 1 call to Perl::Critic::Utils::hashify
306
30713┬Ás111┬Ás for my $policy_name ( $profile->listed_policies() ) {
# spent 11┬Ás making 1 call to Perl::Critic::UserProfile::listed_policies
308 if ( not exists $known_policies{$policy_name} ) {
309 my $message = qq{Policy "$policy_name" is not installed.};
310
311 if ( $errors ) {
312 $errors->add_exception(
313 Perl::Critic::Exception::Configuration::NonExistentPolicy->new(
314 policy => $policy_name,
315 )
316 );
317 }
318 else {
319 warn qq{$message\n};
320 }
321 }
322 }
323
32417┬Ás return;
325}
326
327#-----------------------------------------------------------------------------
328
32914┬Ás1;
330
331__END__
 
# spent 769┬Ás within Perl::Critic::PolicyFactory::CORE:sort which was called 53 times, avg 15┬Ás/call: # 53 times (769┬Ás+0s) by Perl::Critic::PolicyFactory::site_policy_names at line 239, avg 15┬Ás/call
sub Perl::Critic::PolicyFactory::CORE:sort; # opcode