Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/ValuesAndExpressions/ProhibitSpecialLiteralHeredocTerminator.pm |
Statements | Executed 18 statements in 348µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 17µs | 17µs | BEGIN@10 | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
1 | 1 | 1 | 8µs | 57µs | BEGIN@17 | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
1 | 1 | 1 | 8µs | 28µs | BEGIN@14 | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
1 | 1 | 1 | 7µs | 147µs | BEGIN@16 | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
1 | 1 | 1 | 7µs | 18µs | BEGIN@11 | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
1 | 1 | 1 | 7µs | 11µs | BEGIN@12 | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
1 | 1 | 1 | 6µs | 7µs | default_severity | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
1 | 1 | 1 | 5µs | 5µs | supported_parameters | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::
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::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator; | ||||
9 | |||||
10 | 2 | 45µs | 1 | 17µs | # spent 17µs within Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::BEGIN@10 which was called:
# once (17µs+0s) by Module::Pluggable::Object::_require at line 10 # spent 17µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::BEGIN@10 |
11 | 2 | 21µs | 2 | 30µs | # spent 18µs (7+11) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::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::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::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::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::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::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 22µs | 2 | 48µs | # spent 28µs (8+20) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::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::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::BEGIN@14
# spent 20µs making 1 call to Exporter::import |
15 | |||||
16 | 2 | 26µs | 2 | 287µs | # spent 147µs (7+140) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::BEGIN@16 which was called:
# once (7µs+140µs) by Module::Pluggable::Object::_require at line 16 # spent 147µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::BEGIN@16
# spent 140µs making 1 call to Exporter::import |
17 | 2 | 191µs | 2 | 107µs | # spent 57µs (8+50) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::BEGIN@17 which was called:
# once (8µs+50µs) by Module::Pluggable::Object::_require at line 17 # spent 57µs making 1 call to Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::BEGIN@17
# spent 50µs making 1 call to base::import |
18 | |||||
19 | 1 | 600ns | our $VERSION = '1.121'; | ||
20 | |||||
21 | #----------------------------------------------------------------------------- | ||||
22 | |||||
23 | 1 | 5µs | 1 | 31µs | Readonly::Hash my %SPECIAL_LITERAL => map { '__' . $_ . '__' => 1 } # spent 31µs making 1 call to Readonly::Hash |
24 | qw( FILE LINE PACKAGE END DATA ); | ||||
25 | 1 | 1µs | 1 | 23µs | Readonly::Scalar my $DESC => # spent 23µs making 1 call to Readonly::Scalar |
26 | q{Heredoc terminator must not be a special literal}; | ||||
27 | |||||
28 | #----------------------------------------------------------------------------- | ||||
29 | |||||
30 | 1 | 13µs | # spent 5µs within Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::supported_parameters which was called:
# once (5µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||
31 | 1 | 2µs | # spent 7µs (6+1) within Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator::default_severity which was called:
# once (6µs+1µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
32 | sub default_themes { return qw(core maintenance) } | ||||
33 | sub applies_to { return 'PPI::Token::HereDoc' } | ||||
34 | |||||
35 | #----------------------------------------------------------------------------- | ||||
36 | |||||
37 | sub violates { | ||||
38 | my ( $self, $elem, undef ) = @_; | ||||
39 | |||||
40 | # remove << and (optional) quotes from around terminator | ||||
41 | ( my $heredoc_terminator = $elem ) =~ | ||||
42 | s{ \A << \s* (["']?) (.*) \1 \z }{$2}xms; | ||||
43 | |||||
44 | if ( $SPECIAL_LITERAL{ $heredoc_terminator } ) { | ||||
45 | my $expl = qq{Used "$heredoc_terminator" as heredoc terminator}; | ||||
46 | return $self->violation( $DESC, $expl, $elem ); | ||||
47 | } | ||||
48 | |||||
49 | return; #ok! | ||||
50 | } | ||||
51 | |||||
52 | 1 | 4µs | 1; | ||
53 | |||||
54 | __END__ |