← 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