← 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/PolicyParameter.pm
StatementsExecuted 5873 statements in 13.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
9711867┬Ás3.94msPerl::Critic::PolicyParameter::::parse_and_validate_config_valuePerl::Critic::PolicyParameter::parse_and_validate_config_value
9711856┬Ás1.34msPerl::Critic::PolicyParameter::::_finish_standard_initializationPerl::Critic::PolicyParameter::_finish_standard_initialization
9711850┬Ás4.70msPerl::Critic::PolicyParameter::::newPerl::Critic::PolicyParameter::new
9711685┬Ás2.51msPerl::Critic::PolicyParameter::::_initialize_from_behaviorPerl::Critic::PolicyParameter::_initialize_from_behavior
9721597┬Ás747┬ÁsPerl::Critic::PolicyParameter::::_get_behavior_for_namePerl::Critic::PolicyParameter::_get_behavior_for_name
111587┬Ás1.06msPerl::Critic::PolicyParameter::::BEGIN@25Perl::Critic::PolicyParameter::BEGIN@25
111477┬Ás830┬ÁsPerl::Critic::PolicyParameter::::BEGIN@26Perl::Critic::PolicyParameter::BEGIN@26
111367┬Ás757┬ÁsPerl::Critic::PolicyParameter::::BEGIN@28Perl::Critic::PolicyParameter::BEGIN@28
28132366┬Ás366┬ÁsPerl::Critic::PolicyParameter::::get_namePerl::Critic::PolicyParameter::get_name
19476311┬Ás311┬ÁsPerl::Critic::PolicyParameter::::_set_parserPerl::Critic::PolicyParameter::_set_parser
111278┬Ás1.34msPerl::Critic::PolicyParameter::::BEGIN@24Perl::Critic::PolicyParameter::BEGIN@24
111264┬Ás584┬ÁsPerl::Critic::PolicyParameter::::BEGIN@23Perl::Critic::PolicyParameter::BEGIN@23
111248┬Ás1.27msPerl::Critic::PolicyParameter::::BEGIN@27Perl::Critic::PolicyParameter::BEGIN@27
9711177┬Ás177┬ÁsPerl::Critic::PolicyParameter::::_set_default_stringPerl::Critic::PolicyParameter::_set_default_string
9711169┬Ás169┬ÁsPerl::Critic::PolicyParameter::::_set_descriptionPerl::Critic::PolicyParameter::_set_description
9711121┬Ás121┬ÁsPerl::Critic::PolicyParameter::::_get_parserPerl::Critic::PolicyParameter::_get_parser
8898117┬Ás117┬ÁsPerl::Critic::PolicyParameter::::get_default_stringPerl::Critic::PolicyParameter::get_default_string
684380┬Ás80┬ÁsPerl::Critic::PolicyParameter::::_get_behavior_valuesPerl::Critic::PolicyParameter::_get_behavior_values
11114┬Ás14┬ÁsPerl::Critic::PolicyParameter::::BEGIN@10Perl::Critic::PolicyParameter::BEGIN@10
11112┬Ás31┬ÁsPerl::Critic::PolicyParameter::::BEGIN@22Perl::Critic::PolicyParameter::BEGIN@22
1117┬Ás263┬ÁsPerl::Critic::PolicyParameter::::BEGIN@30Perl::Critic::PolicyParameter::BEGIN@30
1117┬Ás18┬ÁsPerl::Critic::PolicyParameter::::BEGIN@11Perl::Critic::PolicyParameter::BEGIN@11
1117┬Ás30┬ÁsPerl::Critic::PolicyParameter::::BEGIN@19Perl::Critic::PolicyParameter::BEGIN@19
1117┬Ás11┬ÁsPerl::Critic::PolicyParameter::::BEGIN@15Perl::Critic::PolicyParameter::BEGIN@15
1117┬Ás66┬ÁsPerl::Critic::PolicyParameter::::BEGIN@31Perl::Critic::PolicyParameter::BEGIN@31
1117┬Ás10┬ÁsPerl::Critic::PolicyParameter::::BEGIN@12Perl::Critic::PolicyParameter::BEGIN@12
1116┬Ás24┬ÁsPerl::Critic::PolicyParameter::::BEGIN@13Perl::Critic::PolicyParameter::BEGIN@13
0000s0sPerl::Critic::PolicyParameter::::__ANON__[:270]Perl::Critic::PolicyParameter::__ANON__[:270]
0000s0sPerl::Critic::PolicyParameter::::__ANON__[:271]Perl::Critic::PolicyParameter::__ANON__[:271]
0000s0sPerl::Critic::PolicyParameter::::__ANON__[:272]Perl::Critic::PolicyParameter::__ANON__[:272]
0000s0sPerl::Critic::PolicyParameter::::__ANON__[:273]Perl::Critic::PolicyParameter::__ANON__[:273]
0000s0sPerl::Critic::PolicyParameter::::_generate_full_descriptionPerl::Critic::PolicyParameter::_generate_full_description
0000s0sPerl::Critic::PolicyParameter::::_get_behaviorPerl::Critic::PolicyParameter::_get_behavior
0000s0sPerl::Critic::PolicyParameter::::_get_description_with_trailing_periodPerl::Critic::PolicyParameter::_get_description_with_trailing_period
0000s0sPerl::Critic::PolicyParameter::::generate_full_descriptionPerl::Critic::PolicyParameter::generate_full_description
0000s0sPerl::Critic::PolicyParameter::::get_descriptionPerl::Critic::PolicyParameter::get_description
0000s0sPerl::Critic::PolicyParameter::::to_formatted_stringPerl::Critic::PolicyParameter::to_formatted_string
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::PolicyParameter;
9
10238┬Ás114┬Ás
# spent 14┬Ás within Perl::Critic::PolicyParameter::BEGIN@10 which was called: # once (14┬Ás+0s) by Perl::Critic::Policy::BEGIN@45 at line 10
use 5.006001;
# spent 14┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@10
11217┬Ás230┬Ás
# spent 18┬Ás (7+11) within Perl::Critic::PolicyParameter::BEGIN@11 which was called: # once (7┬Ás+11┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 11
use strict;
# spent 18┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@11 # spent 11┬Ás making 1 call to strict::import
12216┬Ás214┬Ás
# spent 10┬Ás (7+4) within Perl::Critic::PolicyParameter::BEGIN@12 which was called: # once (7┬Ás+4┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 12
use warnings;
# spent 10┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@12 # spent 4┬Ás making 1 call to warnings::import
13219┬Ás242┬Ás
# spent 24┬Ás (6+18) within Perl::Critic::PolicyParameter::BEGIN@13 which was called: # once (6┬Ás+18┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 13
use Readonly;
# spent 24┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@13 # spent 18┬Ás making 1 call to Exporter::import
14
15231┬Ás216┬Ás
# spent 11┬Ás (7+4) within Perl::Critic::PolicyParameter::BEGIN@15 which was called: # once (7┬Ás+4┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 15
use Exporter 'import';
# spent 11┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@15 # spent 4┬Ás making 1 call to Exporter::import
16
1712┬Ás128┬ÁsReadonly::Array our @EXPORT_OK => qw{ $NO_DESCRIPTION_AVAILABLE };
# spent 28┬Ás making 1 call to Readonly::Array
18
19224┬Ás252┬Ás
# spent 30┬Ás (7+23) within Perl::Critic::PolicyParameter::BEGIN@19 which was called: # once (7┬Ás+23┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 19
use String::Format qw{ stringf };
# spent 30┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@19 # spent 23┬Ás making 1 call to Exporter::import
20
21use Perl::Critic::Exception::Fatal::PolicyDefinition
22218┬Ás250┬Ás
# spent 31┬Ás (12+19) within Perl::Critic::PolicyParameter::BEGIN@22 which was called: # once (12┬Ás+19┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 22
qw{ throw_policy_definition };
# spent 31┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@22 # spent 19┬Ás making 1 call to Exporter::import
232112┬Ás1584┬Ás
# spent 584┬Ás (264+320) within Perl::Critic::PolicyParameter::BEGIN@23 which was called: # once (264┬Ás+320┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 23
use Perl::Critic::PolicyParameter::Behavior;
# spent 584┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@23
24295┬Ás11.34ms
# spent 1.34ms (278┬Ás+1.07) within Perl::Critic::PolicyParameter::BEGIN@24 which was called: # once (278┬Ás+1.07ms) by Perl::Critic::Policy::BEGIN@45 at line 24
use Perl::Critic::PolicyParameter::Behavior::Boolean;
# spent 1.34ms making 1 call to Perl::Critic::PolicyParameter::BEGIN@24
25285┬Ás11.06ms
# spent 1.06ms (587┬Ás+469┬Ás) within Perl::Critic::PolicyParameter::BEGIN@25 which was called: # once (587┬Ás+469┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 25
use Perl::Critic::PolicyParameter::Behavior::Enumeration;
# spent 1.06ms making 1 call to Perl::Critic::PolicyParameter::BEGIN@25
26295┬Ás1830┬Ás
# spent 830┬Ás (477+354) within Perl::Critic::PolicyParameter::BEGIN@26 which was called: # once (477┬Ás+354┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 26
use Perl::Critic::PolicyParameter::Behavior::Integer;
# spent 830┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@26
27290┬Ás11.27ms
# spent 1.27ms (248┬Ás+1.02) within Perl::Critic::PolicyParameter::BEGIN@27 which was called: # once (248┬Ás+1.02ms) by Perl::Critic::Policy::BEGIN@45 at line 27
use Perl::Critic::PolicyParameter::Behavior::String;
# spent 1.27ms making 1 call to Perl::Critic::PolicyParameter::BEGIN@27
28285┬Ás1757┬Ás
# spent 757┬Ás (367+390) within Perl::Critic::PolicyParameter::BEGIN@28 which was called: # once (367┬Ás+390┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 28
use Perl::Critic::PolicyParameter::Behavior::StringList;
# spent 757┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@28
29
30224┬Ás2518┬Ás
# spent 263┬Ás (7+255) within Perl::Critic::PolicyParameter::BEGIN@30 which was called: # once (7┬Ás+255┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 30
use Perl::Critic::Utils qw{ :characters &interpolate };
# spent 263┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@30 # spent 255┬Ás making 1 call to Exporter::import
312792┬Ás2124┬Ás
# spent 66┬Ás (7+59) within Perl::Critic::PolicyParameter::BEGIN@31 which was called: # once (7┬Ás+59┬Ás) by Perl::Critic::Policy::BEGIN@45 at line 31
use Perl::Critic::Utils::DataConversion qw{ &defined_or_empty };
# spent 66┬Ás making 1 call to Perl::Critic::PolicyParameter::BEGIN@31 # spent 59┬Ás making 1 call to Exporter::import
32
331300nsour $VERSION = '1.121';
34
3511┬Ás132┬ÁsReadonly::Scalar our $NO_DESCRIPTION_AVAILABLE => 'No description available.';
# spent 32┬Ás making 1 call to Readonly::Scalar
36
37#-----------------------------------------------------------------------------
38
39# Grrr... one of the OO limitations of Perl: you can't put references to
40# subclases in a superclass (well, not nicely). This map and method belong
41# in Behavior.pm.
42114┬Ás645┬ÁsReadonly::Hash my %BEHAVIORS =>
# spent 36┬Ás making 1 call to Readonly::Hash # spent 9┬Ás making 5 calls to Perl::Critic::PolicyParameter::Behavior::new, avg 2┬Ás/call
43 (
44 'boolean' => Perl::Critic::PolicyParameter::Behavior::Boolean->new(),
45 'enumeration' => Perl::Critic::PolicyParameter::Behavior::Enumeration->new(),
46 'integer' => Perl::Critic::PolicyParameter::Behavior::Integer->new(),
47 'string' => Perl::Critic::PolicyParameter::Behavior::String->new(),
48 'string list' => Perl::Critic::PolicyParameter::Behavior::StringList->new(),
49 );
50
51
# spent 747┬Ás (597+149) within Perl::Critic::PolicyParameter::_get_behavior_for_name which was called 97 times, avg 8┬Ás/call: # 86 times (526┬Ás+132┬Ás) by Perl::Critic::PolicyParameter::_initialize_from_behavior at line 106, avg 8┬Ás/call # 11 times (71┬Ás+17┬Ás) by Perl::Critic::PolicyParameter::_initialize_from_behavior at line 109, avg 8┬Ás/call
sub _get_behavior_for_name {
529713┬Ás my $behavior_name = shift;
53
5497342┬Ás97149┬Ás my $behavior = $BEHAVIORS{$behavior_name}
# spent 149┬Ás making 97 calls to Readonly::Hash::FETCH, avg 2┬Ás/call
55 or throw_policy_definition qq{There's no "$behavior_name" behavior.};
56
5797194┬Ás return $behavior;
58}
59
60#-----------------------------------------------------------------------------
61
62
# spent 4.70ms (850┬Ás+3.85) within Perl::Critic::PolicyParameter::new which was called 97 times, avg 48┬Ás/call: # 97 times (850┬Ás+3.85ms) by Perl::Critic::Policy::new at line 86 of Perl/Critic/Policy.pm, avg 48┬Ás/call
sub new {
639729┬Ás my ($class, $specification) = @_;
649785┬Ás my $self = bless {}, $class;
65
669715┬Ás defined $specification
67 or throw_policy_definition
68 'Attempt to create a ', __PACKAGE__, ' without a specification.';
69
70971┬Ás my $behavior_specification;
71
729727┬Ás my $specification_type = ref $specification;
739717┬Ás if ( not $specification_type ) {
74 $self->{_name} = $specification;
75
76 $behavior_specification = {};
77 } else {
789717┬Ás $specification_type eq 'HASH'
79 or throw_policy_definition
80 'Attempt to create a ',
81 __PACKAGE__,
82 " with a $specification_type as a specification.",
83 ;
84
859721┬Ás defined $specification->{name}
86 or throw_policy_definition
87 'Attempt to create a ', __PACKAGE__, ' without a name.';
889765┬Ás $self->{_name} = $specification->{name};
89
909716┬Ás $behavior_specification = $specification;
91 }
92
939786┬Ás972.51ms $self->_initialize_from_behavior($behavior_specification);
# spent 2.51ms making 97 calls to Perl::Critic::PolicyParameter::_initialize_from_behavior, avg 26┬Ás/call
949791┬Ás971.34ms $self->_finish_standard_initialization($behavior_specification);
# spent 1.34ms making 97 calls to Perl::Critic::PolicyParameter::_finish_standard_initialization, avg 14┬Ás/call
95
96973.48ms return $self;
97}
98
99# See if the specification includes a Behavior name, and if so, let the
100# Behavior with that name plug in its implementations of parser, etc.
101
# spent 2.51ms (685┬Ás+1.82) within Perl::Critic::PolicyParameter::_initialize_from_behavior which was called 97 times, avg 26┬Ás/call: # 97 times (685┬Ás+1.82ms) by Perl::Critic::PolicyParameter::new at line 93, avg 26┬Ás/call
sub _initialize_from_behavior {
1029717┬Ás my ($self, $specification) = @_;
103
1049721┬Ás my $behavior_name = $specification->{behavior};
105972┬Ás my $behavior;
1069785┬Ás86658┬Ás if ($behavior_name) {
# spent 658┬Ás making 86 calls to Perl::Critic::PolicyParameter::_get_behavior_for_name, avg 8┬Ás/call
107 $behavior = _get_behavior_for_name($behavior_name);
108 } else {
1091111┬Ás1188┬Ás $behavior = _get_behavior_for_name('string');
# spent 88┬Ás making 11 calls to Perl::Critic::PolicyParameter::_get_behavior_for_name, avg 8┬Ás/call
110 }
111
1129732┬Ás $self->{_behavior} = $behavior;
1139736┬Ás $self->{_behavior_values} = {};
114
11597116┬Ás971.08ms $behavior->initialize_parameter($self, $specification);
# spent 383┬Ás making 32 calls to Perl::Critic::PolicyParameter::Behavior::StringList::initialize_parameter, avg 12┬Ás/call # spent 242┬Ás making 14 calls to Perl::Critic::PolicyParameter::Behavior::Integer::initialize_parameter, avg 17┬Ás/call # spent 196┬Ás making 8 calls to Perl::Critic::PolicyParameter::Behavior::Enumeration::initialize_parameter, avg 24┬Ás/call # spent 131┬Ás making 20 calls to Perl::Critic::PolicyParameter::Behavior::Boolean::initialize_parameter, avg 7┬Ás/call # spent 126┬Ás making 23 calls to Perl::Critic::PolicyParameter::Behavior::String::initialize_parameter, avg 5┬Ás/call
116
11797156┬Ás return;
118}
119
120# Grab the rest of the values out of the specification, including overrides
121# of what the Behavior specified.
122
# spent 1.34ms (856┬Ás+483┬Ás) within Perl::Critic::PolicyParameter::_finish_standard_initialization which was called 97 times, avg 14┬Ás/call: # 97 times (856┬Ás+483┬Ás) by Perl::Critic::PolicyParameter::new at line 94, avg 14┬Ás/call
sub _finish_standard_initialization {
1239721┬Ás my ($self, $specification) = @_;
124
1259735┬Ás my $description =
126 $specification->{description} || $NO_DESCRIPTION_AVAILABLE;
1279773┬Ás97169┬Ás $self->_set_description($description);
# spent 169┬Ás making 97 calls to Perl::Critic::PolicyParameter::_set_description, avg 2┬Ás/call
12897104┬Ás97177┬Ás $self->_set_default_string($specification->{default_string});
# spent 177┬Ás making 97 calls to Perl::Critic::PolicyParameter::_set_default_string, avg 2┬Ás/call
129
13097168┬Ás97136┬Ás $self->_set_parser($specification->{parser});
# spent 136┬Ás making 97 calls to Perl::Critic::PolicyParameter::_set_parser, avg 1┬Ás/call
131
13297175┬Ás return;
133}
134
135#-----------------------------------------------------------------------------
136
137
# spent 366┬Ás within Perl::Critic::PolicyParameter::get_name which was called 281 times, avg 1┬Ás/call: # 97 times (132┬Ás+0s) by Perl::Critic::Policy::new at line 103 of Perl/Critic/Policy.pm, avg 1┬Ás/call # 97 times (128┬Ás+0s) by Perl::Critic::PolicyParameter::parse_and_validate_config_value at line 228, avg 1┬Ás/call # 87 times (106┬Ás+0s) by Perl::Critic::Policy::__get_parameter_name at line 140 of Perl/Critic/Policy.pm, avg 1┬Ás/call
sub get_name {
13828141┬Ás my $self = shift;
139
1402814.32ms return $self->{_name};
141}
142
143#-----------------------------------------------------------------------------
144
145sub get_description {
146 my $self = shift;
147
148 return $self->{_description};
149}
150
151
# spent 169┬Ás within Perl::Critic::PolicyParameter::_set_description which was called 97 times, avg 2┬Ás/call: # 97 times (169┬Ás+0s) by Perl::Critic::PolicyParameter::_finish_standard_initialization at line 127, avg 2┬Ás/call
sub _set_description {
1529721┬Ás my ($self, $new_value) = @_;
153
1549711┬Ás return if not defined $new_value;
1559748┬Ás $self->{_description} = $new_value;
156
15797165┬Ás return;
158}
159
160sub _get_description_with_trailing_period {
161 my $self = shift;
162
163 my $description = $self->get_description();
164 if ($description) {
165 if ( $PERIOD ne substr $description, ( length $description ) - 1 ) {
166 $description .= $PERIOD;
167 }
168 } else {
169 $description = $EMPTY;
170 }
171
172 return $description;
173}
174
175#-----------------------------------------------------------------------------
176
177
# spent 117┬Ás within Perl::Critic::PolicyParameter::get_default_string which was called 88 times, avg 1┬Ás/call: # 32 times (43┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::StringList::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/StringList.pm:60] at line 45 of Perl/Critic/PolicyParameter/Behavior/StringList.pm, avg 1┬Ás/call # 20 times (28┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Boolean::_parse at line 25 of Perl/Critic/PolicyParameter/Behavior/Boolean.pm, avg 1┬Ás/call # 14 times (19┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Integer::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Integer.pm:82] at line 38 of Perl/Critic/PolicyParameter/Behavior/Integer.pm, avg 1┬Ás/call # 11 times (13┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::String::_parse at line 25 of Perl/Critic/PolicyParameter/Behavior/String.pm, avg 1┬Ás/call # 5 times (6┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm:93] at line 63 of Perl/Critic/PolicyParameter/Behavior/Enumeration.pm, avg 1┬Ás/call # 3 times (4┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm:127] at line 103 of Perl/Critic/PolicyParameter/Behavior/Enumeration.pm, avg 1┬Ás/call # once (2┬Ás+0s) by Perl::Critic::Policy::Subroutines::ProtectPrivateSubs::_parse_private_name_regex at line 102 of Perl/Critic/Policy/Subroutines/ProtectPrivateSubs.pm # once (1┬Ás+0s) by Perl::Critic::Policy::Modules::ProhibitEvilModules::_parse_modules at line 111 of Perl/Critic/Policy/Modules/ProhibitEvilModules.pm # once (1┬Ás+0s) by Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines::_parse_private_name_regex at line 63 of Perl/Critic/Policy/Subroutines/ProhibitUnusedPrivateSubroutines.pm
sub get_default_string {
1788811┬Ás my $self = shift;
179
18088219┬Ás return $self->{_default_string};
181}
182
183
# spent 177┬Ás within Perl::Critic::PolicyParameter::_set_default_string which was called 97 times, avg 2┬Ás/call: # 97 times (177┬Ás+0s) by Perl::Critic::PolicyParameter::_finish_standard_initialization at line 128, avg 2┬Ás/call
sub _set_default_string {
1849725┬Ás my ($self, $new_value) = @_;
185
1869726┬Ás return if not defined $new_value;
1878845┬Ás $self->{_default_string} = $new_value;
188
18988146┬Ás return;
190}
191
192#-----------------------------------------------------------------------------
193
194sub _get_behavior {
195 my $self = shift;
196
197 return $self->{_behavior};
198}
199
200
# spent 80┬Ás within Perl::Critic::PolicyParameter::_get_behavior_values which was called 68 times, avg 1┬Ás/call: # 32 times (36┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::StringList::initialize_parameter at line 30 of Perl/Critic/PolicyParameter/Behavior/StringList.pm, avg 1┬Ás/call # 14 times (19┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Integer::initialize_parameter at line 28 of Perl/Critic/PolicyParameter/Behavior/Integer.pm, avg 1┬Ás/call # 14 times (15┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Integer::initialize_parameter at line 29 of Perl/Critic/PolicyParameter/Behavior/Integer.pm, avg 1┬Ás/call # 8 times (10┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Enumeration::initialize_parameter at line 49 of Perl/Critic/PolicyParameter/Behavior/Enumeration.pm, avg 1┬Ás/call
sub _get_behavior_values {
201689┬Ás my $self = shift;
202
20368142┬Ás return $self->{_behavior_values};
204}
205
206#-----------------------------------------------------------------------------
207
208
# spent 121┬Ás within Perl::Critic::PolicyParameter::_get_parser which was called 97 times, avg 1┬Ás/call: # 97 times (121┬Ás+0s) by Perl::Critic::PolicyParameter::parse_and_validate_config_value at line 230, avg 1┬Ás/call
sub _get_parser {
2099713┬Ás my $self = shift;
210
21197189┬Ás return $self->{_parser};
212}
213
214
# spent 311┬Ás within Perl::Critic::PolicyParameter::_set_parser which was called 194 times, avg 2┬Ás/call: # 97 times (136┬Ás+0s) by Perl::Critic::PolicyParameter::_finish_standard_initialization at line 130, avg 1┬Ás/call # 32 times (54┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::StringList::initialize_parameter at line 61 of Perl/Critic/PolicyParameter/Behavior/StringList.pm, avg 2┬Ás/call # 23 times (36┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::String::initialize_parameter at line 41 of Perl/Critic/PolicyParameter/Behavior/String.pm, avg 2┬Ás/call # 20 times (44┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Boolean::initialize_parameter at line 47 of Perl/Critic/PolicyParameter/Behavior/Boolean.pm, avg 2┬Ás/call # 14 times (26┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Integer::initialize_parameter at line 83 of Perl/Critic/PolicyParameter/Behavior/Integer.pm, avg 2┬Ás/call # 5 times (8┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Enumeration::initialize_parameter at line 94 of Perl/Critic/PolicyParameter/Behavior/Enumeration.pm, avg 2┬Ás/call # 3 times (5┬Ás+0s) by Perl::Critic::PolicyParameter::Behavior::Enumeration::initialize_parameter at line 128 of Perl/Critic/PolicyParameter/Behavior/Enumeration.pm, avg 2┬Ás/call
sub _set_parser {
21519461┬Ás my ($self, $new_value) = @_;
216
217194167┬Ás return if not defined $new_value;
21810930┬Ás $self->{_parser} = $new_value;
219
220109224┬Ás return;
221}
222
223#-----------------------------------------------------------------------------
224
225
# spent 3.94ms (867┬Ás+3.07) within Perl::Critic::PolicyParameter::parse_and_validate_config_value which was called 97 times, avg 41┬Ás/call: # 97 times (867┬Ás+3.07ms) by Perl::Critic::Policy::new at line 97 of Perl/Critic/Policy.pm, avg 41┬Ás/call
sub parse_and_validate_config_value {
2269724┬Ás my ($self, $policy, $config) = @_;
227
22897120┬Ás97128┬Ás my $config_string = $config->{$self->get_name()};
# spent 128┬Ás making 97 calls to Perl::Critic::PolicyParameter::get_name, avg 1┬Ás/call
229
23097112┬Ás97121┬Ás my $parser = $self->_get_parser();
# spent 121┬Ás making 97 calls to Perl::Critic::PolicyParameter::_get_parser, avg 1┬Ás/call
23197127┬Ás972.82ms if ($parser) {
# spent 1.08ms making 32 calls to Perl::Critic::PolicyParameter::Behavior::StringList::__ANON__[Perl/Critic/PolicyParameter/Behavior/StringList.pm:60], avg 34┬Ás/call # spent 527┬Ás making 20 calls to Perl::Critic::PolicyParameter::Behavior::Boolean::_parse, avg 26┬Ás/call # spent 418┬Ás making 14 calls to Perl::Critic::PolicyParameter::Behavior::Integer::__ANON__[Perl/Critic/PolicyParameter/Behavior/Integer.pm:82], avg 30┬Ás/call # spent 196┬Ás making 11 calls to Perl::Critic::PolicyParameter::Behavior::String::_parse, avg 18┬Ás/call # spent 186┬Ás making 1 call to Perl::Critic::Policy::Modules::ProhibitEvilModules::_parse_modules # spent 160┬Ás making 5 calls to Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[Perl/Critic/PolicyParameter/Behavior/Enumeration.pm:93], avg 32┬Ás/call # spent 76┬Ás making 3 calls to Perl::Critic::PolicyParameter::Behavior::Enumeration::__ANON__[Perl/Critic/PolicyParameter/Behavior/Enumeration.pm:127], avg 25┬Ás/call # spent 58┬Ás making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers::_parse_allowed_values # spent 50┬Ás making 1 call to Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines::_parse_private_name_regex # spent 46┬Ás making 1 call to Perl::Critic::Policy::Subroutines::ProtectPrivateSubs::_parse_private_name_regex # spent 6┬Ás making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals::_parse_allow # spent 6┬Ás making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoStrict::_parse_allow # spent 4┬Ás making 1 call to Perl::Critic::Policy::TestingAndDebugging::ProhibitNoWarnings::_parse_allow # spent 3┬Ás making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::_parse_variables # spent 3┬Ás making 1 call to Perl::Critic::Policy::Documentation::RequirePodSections::_parse_lib_sections # spent 2┬Ás making 1 call to Perl::Critic::Policy::Documentation::RequirePodSections::_parse_script_sections # spent 2┬Ás making 1 call to Perl::Critic::Policy::Modules::ProhibitEvilModules::_parse_modules_file # spent 2┬Ás making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::_parse_variables_file
232 $parser->($policy, $self, $config_string);
233 }
234
23597158┬Ás return;
236}
237
238#-----------------------------------------------------------------------------
239
240sub generate_full_description {
241 my ($self) = @_;
242
243 return $self->_get_behavior()->generate_parameter_description($self);
244}
245
246#-----------------------------------------------------------------------------
247
248sub _generate_full_description {
249 my ($self, $prefix) = @_;
250
251 my $description = $self->generate_full_description();
252
253 if (not $description) {
254 return $EMPTY;
255 }
256
257 if ($prefix) {
258 $description =~ s/ ^ /$prefix/xmsg;
259 }
260
261 return $description;
262}
263
264#-----------------------------------------------------------------------------
265
266sub to_formatted_string {
267 my ($self, $format) = @_;
268
269 my %specification = (
270 n => sub { $self->get_name() },
271 d => sub { defined_or_empty( $self->get_description() ) },
272 D => sub { defined_or_empty( $self->get_default_string() ) },
273 f => sub { $self->_generate_full_description(@_) },
274 );
275
276 return stringf( interpolate($format), %specification );
277}
278
279#-----------------------------------------------------------------------------
280
28116┬Ás1;
282
283__END__