Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Subroutines/ProhibitBuiltinHomonyms.pm |
Statements | Executed 20 statements in 365µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 16µs | 16µs | BEGIN@10 | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
1 | 1 | 1 | 8µs | 59µs | BEGIN@18 | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
1 | 1 | 1 | 8µs | 29µs | BEGIN@13 | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
1 | 1 | 1 | 7µs | 638µs | BEGIN@15 | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
1 | 1 | 1 | 7µs | 18µs | BEGIN@11 | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
1 | 1 | 1 | 7µs | 11µs | BEGIN@12 | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
1 | 1 | 1 | 6µs | 7µs | default_severity | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
1 | 1 | 1 | 2µs | 2µs | supported_parameters | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::
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::Subroutines::ProhibitBuiltinHomonyms; | ||||
9 | |||||
10 | 2 | 41µs | 1 | 16µs | # spent 16µs within Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::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::Subroutines::ProhibitBuiltinHomonyms::BEGIN@10 |
11 | 2 | 20µs | 2 | 30µs | # spent 18µs (7+11) within Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::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::Subroutines::ProhibitBuiltinHomonyms::BEGIN@11
# spent 11µs making 1 call to strict::import |
12 | 2 | 18µs | 2 | 14µs | # spent 11µs (7+4) within Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::BEGIN@12 which was called:
# once (7µs+4µs) by Module::Pluggable::Object::_require at line 12 # spent 11µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | 2 | 25µs | 2 | 50µs | # spent 29µs (8+21) within Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::BEGIN@13 which was called:
# once (8µs+21µs) by Module::Pluggable::Object::_require at line 13 # spent 29µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::BEGIN@13
# spent 21µs making 1 call to Exporter::import |
14 | |||||
15 | 1 | 200ns | # spent 638µs (7+631) within Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::BEGIN@15 which was called:
# once (7µs+631µs) by Module::Pluggable::Object::_require at line 16 | ||
16 | 1 | 28µs | 2 | 1.27ms | :classification :characters }; # spent 638µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::BEGIN@15
# spent 631µs making 1 call to Exporter::import |
17 | |||||
18 | 2 | 211µs | 2 | 110µs | # spent 59µs (8+51) within Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::BEGIN@18 which was called:
# once (8µs+51µs) by Module::Pluggable::Object::_require at line 18 # spent 59µs making 1 call to Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::BEGIN@18
# spent 51µs making 1 call to base::import |
19 | |||||
20 | 1 | 500ns | our $VERSION = '1.121'; | ||
21 | |||||
22 | #----------------------------------------------------------------------------- | ||||
23 | |||||
24 | 1 | 2µs | 1 | 26µs | Readonly::Array my @ALLOW => qw( import AUTOLOAD DESTROY ); # spent 26µs making 1 call to Readonly::Array |
25 | 1 | 6µs | 3 | 39µs | Readonly::Hash my %ALLOW => hashify( @ALLOW ); # spent 23µs making 1 call to Readonly::Hash
# spent 15µs making 1 call to Perl::Critic::Utils::hashify
# spent 1µs making 1 call to Readonly::Array::FETCHSIZE |
26 | 1 | 1µs | 1 | 22µs | Readonly::Scalar my $DESC => q{Subroutine name is a homonym for builtin %s %s}; # spent 22µs making 1 call to Readonly::Scalar |
27 | 1 | 2µs | 1 | 40µs | Readonly::Scalar my $EXPL => [177]; # spent 40µs making 1 call to Readonly::Scalar |
28 | |||||
29 | #----------------------------------------------------------------------------- | ||||
30 | |||||
31 | 1 | 4µs | # spent 2µs within Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::supported_parameters which was called:
# once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||
32 | 1 | 2µs | # spent 7µs (6+1) within Perl::Critic::Policy::Subroutines::ProhibitBuiltinHomonyms::default_severity which was called:
# once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
33 | sub default_themes { return qw( core bugs pbp certrule ) } | ||||
34 | sub applies_to { return 'PPI::Statement::Sub' } | ||||
35 | |||||
36 | #----------------------------------------------------------------------------- | ||||
37 | |||||
38 | sub violates { | ||||
39 | my ( $self, $elem, undef ) = @_; | ||||
40 | return if $elem->isa('PPI::Statement::Scheduled'); #e.g. BEGIN, INIT, END | ||||
41 | return if exists $ALLOW{ $elem->name() }; | ||||
42 | |||||
43 | my $homonym_type = $EMPTY; | ||||
44 | if ( is_perl_builtin( $elem ) ) { | ||||
45 | $homonym_type = 'function'; | ||||
46 | } | ||||
47 | elsif ( is_perl_bareword( $elem ) ) { | ||||
48 | $homonym_type = 'keyword'; | ||||
49 | } | ||||
50 | else { | ||||
51 | return; #ok! | ||||
52 | } | ||||
53 | |||||
54 | my $desc = sprintf $DESC, $homonym_type, $elem->name(); | ||||
55 | return $self->violation($desc, $EXPL, $elem); | ||||
56 | } | ||||
57 | |||||
58 | 1 | 6µs | 1; | ||
59 | |||||
60 | __END__ |