| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Variables/ProhibitEvilVariables.pm |
| Statements | Executed 38 statements in 1.46ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 3 | 3 | 1 | 101µs | 108µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 21µs | 25µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::supported_parameters |
| 1 | 1 | 1 | 17µs | 17µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@9 |
| 9 | 6 | 1 | 11µs | 11µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:qr (opcode) |
| 1 | 1 | 1 | 8µs | 28µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@14 |
| 1 | 1 | 1 | 8µs | 12µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@11 |
| 1 | 1 | 1 | 8µs | 48µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@17 |
| 1 | 1 | 1 | 8µs | 29µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@21 |
| 1 | 1 | 1 | 8µs | 20µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@10 |
| 1 | 1 | 1 | 8µs | 397µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@13 |
| 1 | 1 | 1 | 8µs | 392µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@18 |
| 1 | 1 | 1 | 7µs | 58µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@23 |
| 1 | 1 | 1 | 6µs | 7µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::default_severity |
| 1 | 1 | 1 | 4µs | 4µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::initialize_if_enabled |
| 1 | 1 | 1 | 3µs | 3µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::_parse_variables |
| 1 | 1 | 1 | 2µs | 2µs | Perl::Critic::Policy::Variables::ProhibitEvilVariables::_parse_variables_file |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::Policy::Variables::ProhibitEvilVariables::_compute_symbol_names |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::Policy::Variables::ProhibitEvilVariables::_handle_variable_specification |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::Policy::Variables::ProhibitEvilVariables::_handle_variable_specification_on_line |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::Policy::Variables::ProhibitEvilVariables::_make_violation |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::Policy::Variables::ProhibitEvilVariables::applies_to |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::Policy::Variables::ProhibitEvilVariables::default_themes |
| 0 | 0 | 0 | 0s | 0s | Perl::Critic::Policy::Variables::ProhibitEvilVariables::violates |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | ############################################################################## | ||||
| 2 | # $URL$ | ||||
| 3 | # $Date$ | ||||
| 4 | # $Author$ | ||||
| 5 | # $Revision$ | ||||
| 6 | ############################################################################## | ||||
| 7 | package Perl::Critic::Policy::Variables::ProhibitEvilVariables; | ||||
| 8 | |||||
| 9 | 2 | 45µs | 1 | 17µs | # spent 17µs within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@9 which was called:
# once (17µs+0s) by Module::Pluggable::Object::_require at line 9 # spent 17µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@9 |
| 10 | 2 | 21µs | 2 | 32µs | # spent 20µs (8+12) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@10 which was called:
# once (8µs+12µs) by Module::Pluggable::Object::_require at line 10 # spent 20µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@10
# spent 12µs making 1 call to strict::import |
| 11 | 2 | 22µs | 2 | 16µs | # spent 12µs (8+4) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@11 which was called:
# once (8µs+4µs) by Module::Pluggable::Object::_require at line 11 # spent 12µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@11
# spent 4µs making 1 call to warnings::import |
| 12 | |||||
| 13 | 2 | 23µs | 2 | 786µs | # spent 397µs (8+389) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@13 which was called:
# once (8µs+389µs) by Module::Pluggable::Object::_require at line 13 # spent 397µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@13
# spent 389µs making 1 call to English::import |
| 14 | 2 | 24µs | 2 | 48µs | # spent 28µs (8+20) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@14 which was called:
# once (8µs+20µs) by Module::Pluggable::Object::_require at line 14 # spent 28µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@14
# spent 20µs making 1 call to Exporter::import |
| 15 | |||||
| 16 | use Perl::Critic::Exception::Configuration::Option::Policy::ParameterValue | ||||
| 17 | 2 | 25µs | 2 | 88µs | # spent 48µs (8+40) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@17 which was called:
# once (8µs+40µs) by Module::Pluggable::Object::_require at line 17 # spent 48µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@17
# spent 40µs making 1 call to Exporter::import |
| 18 | 1 | 200ns | # spent 392µs (8+385) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@18 which was called:
# once (8µs+385µs) by Module::Pluggable::Object::_require at line 20 | ||
| 19 | :characters :severities :data_conversion | ||||
| 20 | 1 | 25µs | 2 | 777µs | }; # spent 392µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@18
# spent 385µs making 1 call to Exporter::import |
| 21 | 2 | 22µs | 2 | 51µs | # spent 29µs (8+21) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@21 which was called:
# once (8µs+21µs) by Module::Pluggable::Object::_require at line 21 # spent 29µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@21
# spent 21µs making 1 call to Exporter::import |
| 22 | |||||
| 23 | 2 | 1.03ms | 2 | 109µs | # spent 58µs (7+51) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@23 which was called:
# once (7µs+51µs) by Module::Pluggable::Object::_require at line 23 # spent 58µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::BEGIN@23
# spent 51µs making 1 call to base::import |
| 24 | |||||
| 25 | 1 | 600ns | our $VERSION = '1.121'; | ||
| 26 | |||||
| 27 | #----------------------------------------------------------------------------- | ||||
| 28 | |||||
| 29 | 1 | 2µs | 1 | 32µs | Readonly::Scalar my $EXPL => q{Find an alternative variable}; # spent 32µs making 1 call to Readonly::Scalar |
| 30 | |||||
| 31 | 1 | 3µs | 2 | 31µs | Readonly::Hash my %SUBSCRIPTED_TYPE => hashify(qw{@ %}); # spent 28µs making 1 call to Readonly::Hash
# spent 3µs making 1 call to Perl::Critic::Utils::hashify |
| 32 | |||||
| 33 | 1 | 7µs | 2 | 33µs | Readonly::Scalar my $VARIABLE_NAME_REGEX => qr< [\$\@%] \S+ >xms; # spent 32µs making 1 call to Readonly::Scalar
# spent 1µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:qr |
| 34 | 1 | 4µs | 2 | 21µs | Readonly::Scalar my $REGULAR_EXPRESSION_REGEX => # spent 20µs making 1 call to Readonly::Scalar
# spent 1µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:qr |
| 35 | qr< [/] ( [^/]+ ) [/] >xms; | ||||
| 36 | 1 | 11µs | 5 | 24µs | Readonly::Array my @DESCRIPTION_REGEXES => # spent 21µs making 1 call to Readonly::Array
# spent 3µs making 4 calls to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:qr, avg 725ns/call |
| 37 | qr< [{] ( [^}]+ ) [}] >xms, | ||||
| 38 | qr{ < ( [^>]+ ) > }xms, | ||||
| 39 | qr{ [[] ( [^]]+ ) []] }xms, | ||||
| 40 | qr{ [(] ( [^)]+ ) [)] }xms, | ||||
| 41 | ; | ||||
| 42 | Readonly::Scalar my $DESCRIPTION_REGEX => | ||||
| 43 | 1 | 49µs | 8 | 56µs | qr< @{[join '|', @DESCRIPTION_REGEXES]} >xms; # spent 26µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:regcomp
# spent 22µs making 1 call to Readonly::Scalar
# spent 5µs making 4 calls to Readonly::Array::FETCH, avg 1µs/call
# spent 1µs making 1 call to Readonly::Array::FETCHSIZE
# spent 1µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:qr |
| 44 | |||||
| 45 | # It's kind of unfortunate that I had to put capturing parentheses in the | ||||
| 46 | # component regexes above, because they're not visible here and so make | ||||
| 47 | # figuring out the positions of captures hard. Too bad we can't make the | ||||
| 48 | # minimum perl version 5.10. :] | ||||
| 49 | 1 | 52µs | 6 | 80µs | Readonly::Scalar my $VARIABLES_REGEX => # spent 52µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:regcomp
# spent 23µs making 1 call to Readonly::Scalar
# spent 4µs making 3 calls to Readonly::Scalar::FETCH, avg 1µs/call
# spent 1µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:qr |
| 50 | qr< | ||||
| 51 | \A | ||||
| 52 | \s* | ||||
| 53 | (?: | ||||
| 54 | ( $VARIABLE_NAME_REGEX ) | ||||
| 55 | | $REGULAR_EXPRESSION_REGEX | ||||
| 56 | ) | ||||
| 57 | (?: \s* $DESCRIPTION_REGEX )? | ||||
| 58 | \s* | ||||
| 59 | >xms; | ||||
| 60 | |||||
| 61 | 1 | 35µs | 5 | 58µs | Readonly::Scalar my $VARIABLES_FILE_LINE_REGEX => # spent 30µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:regcomp
# spent 23µs making 1 call to Readonly::Scalar
# spent 3µs making 1 call to Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:qr
# spent 2µs making 2 calls to Readonly::Scalar::FETCH, avg 1µs/call |
| 62 | qr< | ||||
| 63 | \A | ||||
| 64 | \s* | ||||
| 65 | (?: | ||||
| 66 | ( $VARIABLE_NAME_REGEX ) | ||||
| 67 | | $REGULAR_EXPRESSION_REGEX | ||||
| 68 | ) | ||||
| 69 | \s* | ||||
| 70 | ( \S (?: .* \S )? )? | ||||
| 71 | \s* | ||||
| 72 | \z | ||||
| 73 | >xms; | ||||
| 74 | |||||
| 75 | # Indexes in the arrays of regexes for the "variables" option. | ||||
| 76 | 1 | 1µs | 1 | 20µs | Readonly::Scalar my $INDEX_REGEX => 0; # spent 20µs making 1 call to Readonly::Scalar |
| 77 | 1 | 900ns | 1 | 19µs | Readonly::Scalar my $INDEX_DESCRIPTION => 1; # spent 19µs making 1 call to Readonly::Scalar |
| 78 | |||||
| 79 | #----------------------------------------------------------------------------- | ||||
| 80 | |||||
| 81 | # spent 25µs (21+5) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::supported_parameters which was called:
# once (21µs+5µs) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||||
| 82 | return ( | ||||
| 83 | { | ||||
| 84 | 1 | 16µs | 4 | 5µs | name => 'variables', # spent 5µs making 4 calls to Readonly::Scalar::FETCH, avg 1µs/call |
| 85 | description => 'The names of or patterns for variables to forbid.', | ||||
| 86 | default_string => $EMPTY, | ||||
| 87 | parser => \&_parse_variables, | ||||
| 88 | }, | ||||
| 89 | { | ||||
| 90 | name => 'variables_file', | ||||
| 91 | description => 'A file containing names of or patterns for variables to forbid.', | ||||
| 92 | default_string => $EMPTY, | ||||
| 93 | parser => \&_parse_variables_file, | ||||
| 94 | }, | ||||
| 95 | ); | ||||
| 96 | } | ||||
| 97 | |||||
| 98 | 1 | 2µs | # spent 7µs (6+1) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::default_severity which was called:
# once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
| 99 | sub default_themes { return qw( core bugs ) } | ||||
| 100 | sub applies_to { return qw{PPI::Token::Symbol} } | ||||
| 101 | |||||
| 102 | #----------------------------------------------------------------------------- | ||||
| 103 | |||||
| 104 | # spent 3µs within Perl::Critic::Policy::Variables::ProhibitEvilVariables::_parse_variables which was called:
# once (3µs+0s) by Perl::Critic::PolicyParameter::parse_and_validate_config_value at line 231 of Perl/Critic/PolicyParameter.pm | ||||
| 105 | 1 | 500ns | my ($self, $parameter, $config_string) = @_; | ||
| 106 | |||||
| 107 | 1 | 4µs | return if not $config_string; | ||
| 108 | return if $config_string =~ m< \A \s* \z >xms; | ||||
| 109 | |||||
| 110 | my $variable_specifications = $config_string; | ||||
| 111 | |||||
| 112 | while ( my ($variable, $regex_string, @descrs) = | ||||
| 113 | $variable_specifications =~ m< $VARIABLES_REGEX >xms) { | ||||
| 114 | |||||
| 115 | substr $variable_specifications, 0, $LAST_MATCH_END[0], $EMPTY; | ||||
| 116 | my $description = dor(@descrs); | ||||
| 117 | |||||
| 118 | $self->_handle_variable_specification( | ||||
| 119 | variable => $variable, | ||||
| 120 | regex_string => $regex_string, | ||||
| 121 | description => $description, | ||||
| 122 | option_name => 'variables', | ||||
| 123 | option_value => $config_string, | ||||
| 124 | ); | ||||
| 125 | } | ||||
| 126 | |||||
| 127 | if ($variable_specifications) { | ||||
| 128 | throw_policy_value | ||||
| 129 | policy => $self->get_short_name(), | ||||
| 130 | option_name => 'variables', | ||||
| 131 | option_value => $config_string, | ||||
| 132 | message_suffix => | ||||
| 133 | qq{contains unparseable data: "$variable_specifications"}; | ||||
| 134 | } | ||||
| 135 | |||||
| 136 | return; | ||||
| 137 | } | ||||
| 138 | |||||
| 139 | # spent 2µs within Perl::Critic::Policy::Variables::ProhibitEvilVariables::_parse_variables_file which was called:
# once (2µs+0s) by Perl::Critic::PolicyParameter::parse_and_validate_config_value at line 231 of Perl/Critic/PolicyParameter.pm | ||||
| 140 | 1 | 400ns | my ($self, $parameter, $config_string) = @_; | ||
| 141 | |||||
| 142 | 1 | 4µs | return if not $config_string; | ||
| 143 | return if $config_string =~ m< \A \s* \z >xms; | ||||
| 144 | |||||
| 145 | open my $handle, '<', $config_string | ||||
| 146 | or throw_policy_value | ||||
| 147 | policy => $self->get_short_name(), | ||||
| 148 | option_name => 'variables_file', | ||||
| 149 | option_value => $config_string, | ||||
| 150 | message_suffix => | ||||
| 151 | qq<refers to a file that could not be opened: $OS_ERROR>; | ||||
| 152 | while ( my $line = <$handle> ) { | ||||
| 153 | $self->_handle_variable_specification_on_line($line, $config_string); | ||||
| 154 | } | ||||
| 155 | close $handle or warn qq<Could not close "$config_string": $OS_ERROR\n>; | ||||
| 156 | |||||
| 157 | return; | ||||
| 158 | } | ||||
| 159 | |||||
| 160 | sub _handle_variable_specification_on_line { | ||||
| 161 | my ($self, $line, $config_string) = @_; | ||||
| 162 | |||||
| 163 | $line =~ s< [#] .* \z ><>xms; | ||||
| 164 | $line =~ s< \s+ \z ><>xms; | ||||
| 165 | $line =~ s< \A \s+ ><>xms; | ||||
| 166 | |||||
| 167 | return if not $line; | ||||
| 168 | |||||
| 169 | if ( my ($variable, $regex_string, $description) = | ||||
| 170 | $line =~ m< $VARIABLES_FILE_LINE_REGEX >xms) { | ||||
| 171 | |||||
| 172 | $self->_handle_variable_specification( | ||||
| 173 | variable => $variable, | ||||
| 174 | regex_string => $regex_string, | ||||
| 175 | description => $description, | ||||
| 176 | option_name => 'variables_file', | ||||
| 177 | option_value => $config_string, | ||||
| 178 | ); | ||||
| 179 | } | ||||
| 180 | else { | ||||
| 181 | throw_policy_value | ||||
| 182 | policy => $self->get_short_name(), | ||||
| 183 | option_name => 'variables_file', | ||||
| 184 | option_value => $config_string, | ||||
| 185 | message_suffix => | ||||
| 186 | qq{contains unparseable data: "$line"}; | ||||
| 187 | } | ||||
| 188 | |||||
| 189 | return; | ||||
| 190 | } | ||||
| 191 | |||||
| 192 | sub _handle_variable_specification { | ||||
| 193 | my ($self, %arguments) = @_; | ||||
| 194 | |||||
| 195 | my $description = $arguments{description} || $EMPTY; | ||||
| 196 | |||||
| 197 | if ( my $regex_string = $arguments{regex_string} ) { | ||||
| 198 | # These are variable name patterns (e.g. /acme/) | ||||
| 199 | my $actual_regex; | ||||
| 200 | |||||
| 201 | eval { $actual_regex = qr/$regex_string/sm; ## no critic (ExtendedFormatting) | ||||
| 202 | 1 } | ||||
| 203 | or throw_policy_value | ||||
| 204 | policy => $self->get_short_name(), | ||||
| 205 | option_name => $arguments{option_name}, | ||||
| 206 | option_value => $arguments{option_value}, | ||||
| 207 | message_suffix => | ||||
| 208 | qq{contains an invalid regular expression: "$regex_string"}; | ||||
| 209 | |||||
| 210 | # Can't use a hash due to stringification, so this is an AoA. | ||||
| 211 | push | ||||
| 212 | @{ $self->{_evil_variables_regexes} ||= [] }, | ||||
| 213 | [ $actual_regex, $description ]; | ||||
| 214 | } | ||||
| 215 | else { | ||||
| 216 | # These are literal variable names (e.g. $[) | ||||
| 217 | $self->{_evil_variables} ||= {}; | ||||
| 218 | my $name = $arguments{variable}; | ||||
| 219 | $self->{_evil_variables}{$name} = $description; | ||||
| 220 | } | ||||
| 221 | |||||
| 222 | return; | ||||
| 223 | } | ||||
| 224 | |||||
| 225 | #----------------------------------------------------------------------------- | ||||
| 226 | |||||
| 227 | # spent 4µs within Perl::Critic::Policy::Variables::ProhibitEvilVariables::initialize_if_enabled which was called:
# once (4µs+0s) by Perl::Critic::Config::_add_policy_if_enabled at line 202 of Perl/Critic/Config.pm | ||||
| 228 | 1 | 600ns | my ($self, $config) = @_; | ||
| 229 | |||||
| 230 | # Disable if no variables are specified; there's no point in running if | ||||
| 231 | # there aren't any. | ||||
| 232 | return | ||||
| 233 | 1 | 5µs | exists $self->{_evil_variables} | ||
| 234 | || exists $self->{_evil_variables_regexes}; | ||||
| 235 | } | ||||
| 236 | |||||
| 237 | #----------------------------------------------------------------------------- | ||||
| 238 | |||||
| 239 | sub violates { | ||||
| 240 | my ( $self, $elem, undef ) = @_; | ||||
| 241 | return if not $elem; | ||||
| 242 | |||||
| 243 | my @names = $self->_compute_symbol_names( $elem ) | ||||
| 244 | or return; | ||||
| 245 | |||||
| 246 | my $evil_variables = $self->{_evil_variables}; | ||||
| 247 | my $evil_variables_regexes = $self->{_evil_variables_regexes}; | ||||
| 248 | |||||
| 249 | foreach my $variable (@names) { | ||||
| 250 | exists $evil_variables->{$variable} | ||||
| 251 | and return $self->_make_violation( | ||||
| 252 | $variable, | ||||
| 253 | $evil_variables->{$variable}, | ||||
| 254 | $elem, | ||||
| 255 | ); | ||||
| 256 | } | ||||
| 257 | |||||
| 258 | foreach my $variable (@names) { | ||||
| 259 | foreach my $regex ( @{$evil_variables_regexes} ) { | ||||
| 260 | $variable =~ $regex->[$INDEX_REGEX] | ||||
| 261 | and return $self->_make_violation( | ||||
| 262 | $variable, | ||||
| 263 | $regex->[$INDEX_DESCRIPTION], | ||||
| 264 | $elem, | ||||
| 265 | ); | ||||
| 266 | } | ||||
| 267 | } | ||||
| 268 | |||||
| 269 | return; # ok! | ||||
| 270 | } | ||||
| 271 | |||||
| 272 | #----------------------------------------------------------------------------- | ||||
| 273 | |||||
| 274 | # We are unconditionally interested in the names of the symbol itself. If the | ||||
| 275 | # symbol is subscripted, we are interested in the subscripted form as well. | ||||
| 276 | |||||
| 277 | sub _compute_symbol_names { | ||||
| 278 | my ($self, $elem) = @_; | ||||
| 279 | |||||
| 280 | my @names; | ||||
| 281 | |||||
| 282 | my $name = $elem->symbol(); | ||||
| 283 | push @names, $name; | ||||
| 284 | |||||
| 285 | if ($SUBSCRIPTED_TYPE{$elem->symbol_type()}) { | ||||
| 286 | $name = $elem->content(); | ||||
| 287 | my $next = $elem->snext_sibling(); | ||||
| 288 | my @subscr; | ||||
| 289 | while ($next and $next->isa('PPI::Structure::Subscript')) { | ||||
| 290 | push @subscr, $next->content(); | ||||
| 291 | $next = $next->snext_sibling(); | ||||
| 292 | } | ||||
| 293 | if (@subscr) { | ||||
| 294 | push @names, join $EMPTY, $name, @subscr; | ||||
| 295 | } | ||||
| 296 | } | ||||
| 297 | |||||
| 298 | return @names; | ||||
| 299 | } | ||||
| 300 | |||||
| 301 | #----------------------------------------------------------------------------- | ||||
| 302 | |||||
| 303 | sub _make_violation { | ||||
| 304 | my ($self, $variable, $description, $elem) = @_; | ||||
| 305 | return $self->violation( | ||||
| 306 | $description || qq<Prohibited variable "$variable" used>, | ||||
| 307 | $EXPL, | ||||
| 308 | $elem, | ||||
| 309 | ); | ||||
| 310 | } | ||||
| 311 | |||||
| 312 | 1 | 25µs | 1; | ||
| 313 | |||||
| 314 | __END__ | ||||
# spent 11µs within Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:qr which was called 9 times, avg 1µs/call:
# 4 times (3µs+0s) by Module::Pluggable::Object::_require at line 36, avg 725ns/call
# once (3µs+0s) by Module::Pluggable::Object::_require at line 61
# once (1µs+0s) by Module::Pluggable::Object::_require at line 33
# once (1µs+0s) by Module::Pluggable::Object::_require at line 49
# once (1µs+0s) by Module::Pluggable::Object::_require at line 34
# once (1µs+0s) by Module::Pluggable::Object::_require at line 43 | |||||
# spent 108µs (101+6) within Perl::Critic::Policy::Variables::ProhibitEvilVariables::CORE:regcomp which was called 3 times, avg 36µs/call:
# once (48µs+4µs) by Module::Pluggable::Object::_require at line 49
# once (27µs+2µs) by Module::Pluggable::Object::_require at line 61
# once (26µs+0s) by Module::Pluggable::Object::_require at line 43 |