Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm |
Statements | Executed 19 statements in 387µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 21µs | 25µs | BEGIN@12 | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
1 | 1 | 1 | 16µs | 16µs | BEGIN@10 | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
1 | 1 | 1 | 10µs | 208µs | BEGIN@16 | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
1 | 1 | 1 | 10µs | 36µs | BEGIN@14 | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
1 | 1 | 1 | 9µs | 74µs | BEGIN@17 | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
1 | 1 | 1 | 7µs | 18µs | BEGIN@11 | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
1 | 1 | 1 | 6µs | 7µs | default_severity | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
1 | 1 | 1 | 2µs | 2µs | supported_parameters | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | ############################################################################## | ||||
2 | # $URL$ | ||||
3 | # $Date$ | ||||
4 | # $Author$ | ||||
5 | # $Revision$ | ||||
6 | ############################################################################## | ||||
7 | |||||
8 | package Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames; | ||||
9 | |||||
10 | 2 | 38µs | 1 | 16µs | # spent 16µs within Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@10 which was called:
# once (16µs+0s) by Module::Pluggable::Object::_require at line 10 # spent 16µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@10 |
11 | 2 | 20µs | 2 | 28µs | # spent 18µs (7+11) within Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@11 which was called:
# once (7µs+11µs) by Module::Pluggable::Object::_require at line 11 # spent 18µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@11
# spent 11µs making 1 call to strict::import |
12 | 2 | 26µs | 2 | 28µs | # spent 25µs (21+4) within Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@12 which was called:
# once (21µs+4µs) by Module::Pluggable::Object::_require at line 12 # spent 25µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 34µs | 2 | 63µs | # spent 36µs (10+27) within Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@14 which was called:
# once (10µs+27µs) by Module::Pluggable::Object::_require at line 14 # spent 36µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@14
# spent 27µs making 1 call to Exporter::import |
15 | |||||
16 | 2 | 30µs | 2 | 406µs | # spent 208µs (10+198) within Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@16 which was called:
# once (10µs+198µs) by Module::Pluggable::Object::_require at line 16 # spent 208µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@16
# spent 198µs making 1 call to Exporter::import |
17 | 2 | 219µs | 2 | 139µs | # spent 74µs (9+65) within Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@17 which was called:
# once (9µs+65µs) by Module::Pluggable::Object::_require at line 17 # spent 74µs making 1 call to Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::BEGIN@17
# spent 65µs making 1 call to base::import |
18 | |||||
19 | 1 | 700ns | our $VERSION = '1.121'; | ||
20 | |||||
21 | 1 | 5µs | 2 | 44µs | Readonly::Hash my %SPECIAL_BLOCK_NAMES => # spent 39µs making 1 call to Readonly::Hash
# spent 6µs making 1 call to Perl::Critic::Utils::hashify |
22 | hashify( qw< BEGIN END INIT CHECK UNITCHECK > ); | ||||
23 | |||||
24 | #----------------------------------------------------------------------------- | ||||
25 | |||||
26 | 1 | 1µs | 1 | 30µs | Readonly::Scalar my $DESC => q<Special block name used as label.>; # spent 30µs making 1 call to Readonly::Scalar |
27 | 1 | 1µs | 1 | 26µs | Readonly::Scalar my $EXPL => # spent 26µs making 1 call to Readonly::Scalar |
28 | q<Use a label that cannot be confused with BEGIN, END, CHECK, INIT, or UNITCHECK blocks.>; | ||||
29 | |||||
30 | #----------------------------------------------------------------------------- | ||||
31 | |||||
32 | 1 | 4µs | # spent 2µs within Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::supported_parameters which was called:
# once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||
33 | 1 | 2µs | # spent 7µs (6+1) within Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames::default_severity which was called:
# once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
34 | sub default_themes { return qw< core bugs > } | ||||
35 | sub applies_to { return qw< PPI::Token::Label > } | ||||
36 | |||||
37 | #----------------------------------------------------------------------------- | ||||
38 | |||||
39 | sub violates { | ||||
40 | my ($self, $elem, undef) = @_; | ||||
41 | |||||
42 | # Does the function call have enough arguments? | ||||
43 | my $label = $elem->content(); | ||||
44 | $label =~ s/ \s* : \z //xms; | ||||
45 | return if not $SPECIAL_BLOCK_NAMES{ $label }; | ||||
46 | |||||
47 | return $self->violation( $DESC, $EXPL, $elem ); | ||||
48 | } | ||||
49 | |||||
50 | |||||
51 | 1 | 6µs | 1; | ||
52 | |||||
53 | #----------------------------------------------------------------------------- | ||||
54 | |||||
55 | __END__ |