Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Policy/Documentation/RequirePodAtEnd.pm |
Statements | Executed 21 statements in 416µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 16µs | 16µs | BEGIN@10 | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 13µs | 46µs | BEGIN@15 | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 9µs | 11µs | default_severity | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 8µs | 12µs | BEGIN@12 | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 8µs | 154µs | BEGIN@17 | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 8µs | 19µs | BEGIN@11 | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 7µs | 58µs | BEGIN@18 | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 7µs | 28µs | BEGIN@13 | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 2µs | 2µs | supported_parameters | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
1 | 1 | 1 | 2µs | 2µs | CORE:qr (opcode) | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
0 | 0 | 0 | 0s | 0s | __ANON__[:45] | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
0 | 0 | 0 | 0s | 0s | applies_to | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
0 | 0 | 0 | 0s | 0s | default_themes | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
0 | 0 | 0 | 0s | 0s | violates | Perl::Critic::Policy::Documentation::RequirePodAtEnd::
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::Documentation::RequirePodAtEnd; | ||||
9 | |||||
10 | 2 | 44µs | 1 | 16µs | # spent 16µs within Perl::Critic::Policy::Documentation::RequirePodAtEnd::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::Documentation::RequirePodAtEnd::BEGIN@10 |
11 | 2 | 21µs | 2 | 30µs | # spent 19µs (8+11) within Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@11 which was called:
# once (8µs+11µs) by Module::Pluggable::Object::_require at line 11 # spent 19µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@11
# spent 11µs making 1 call to strict::import |
12 | 2 | 18µs | 2 | 15µs | # spent 12µs (8+4) within Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@12 which was called:
# once (8µs+4µs) by Module::Pluggable::Object::_require at line 12 # spent 12µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | 2 | 22µs | 2 | 48µs | # spent 28µs (7+21) within Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@13 which was called:
# once (7µs+21µs) by Module::Pluggable::Object::_require at line 13 # spent 28µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@13
# spent 21µs making 1 call to Exporter::import |
14 | |||||
15 | 2 | 26µs | 2 | 55µs | # spent 46µs (13+32) within Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@15 which was called:
# once (13µs+32µs) by Module::Pluggable::Object::_require at line 15 # spent 46µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@15
# spent 10µs making 1 call to List::Util::import |
16 | |||||
17 | 2 | 22µs | 2 | 300µs | # spent 154µs (8+146) within Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@17 which was called:
# once (8µs+146µs) by Module::Pluggable::Object::_require at line 17 # spent 154µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@17
# spent 146µs making 1 call to Exporter::import |
18 | 2 | 239µs | 2 | 108µs | # spent 58µs (7+50) within Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@18 which was called:
# once (7µs+50µs) by Module::Pluggable::Object::_require at line 18 # spent 58µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::BEGIN@18
# spent 50µs making 1 call to base::import |
19 | |||||
20 | 1 | 600ns | our $VERSION = '1.121'; | ||
21 | |||||
22 | #----------------------------------------------------------------------------- | ||||
23 | |||||
24 | 1 | 10µs | 2 | 40µs | Readonly::Scalar my $POD_RX => qr{\A = (?: for|begin|end ) }xms; # spent 38µs making 1 call to Readonly::Scalar
# spent 2µs making 1 call to Perl::Critic::Policy::Documentation::RequirePodAtEnd::CORE:qr |
25 | 1 | 1µs | 1 | 22µs | Readonly::Scalar my $DESC => q{POD before __END__}; # spent 22µs making 1 call to Readonly::Scalar |
26 | 1 | 2µs | 1 | 53µs | Readonly::Scalar my $EXPL => [139, 140]; # spent 53µs making 1 call to Readonly::Scalar |
27 | |||||
28 | #----------------------------------------------------------------------------- | ||||
29 | |||||
30 | 1 | 5µs | # spent 2µs within Perl::Critic::Policy::Documentation::RequirePodAtEnd::supported_parameters which was called:
# once (2µs+0s) by Perl::Critic::Policy::new at line 88 of Perl/Critic/Policy.pm | ||
31 | 1 | 2µs | # spent 11µs (9+2) within Perl::Critic::Policy::Documentation::RequirePodAtEnd::default_severity which was called:
# once (9µs+2µs) by Perl::Critic::Policy::get_severity at line 331 of Perl/Critic/Policy.pm | ||
32 | sub default_themes { return qw( core cosmetic pbp ) } | ||||
33 | sub applies_to { return 'PPI::Document' } | ||||
34 | |||||
35 | #----------------------------------------------------------------------------- | ||||
36 | |||||
37 | sub violates { | ||||
38 | my ( $self, $elem, $doc ) = @_; | ||||
39 | |||||
40 | # No POD means no violation | ||||
41 | my $pods_ref = $doc->find('PPI::Token::Pod'); | ||||
42 | return if !$pods_ref; | ||||
43 | |||||
44 | # Look for first POD tag that isn't =for, =begin, or =end | ||||
45 | my $pod = first { $_ !~ $POD_RX} @{ $pods_ref }; | ||||
46 | return if !$pod; | ||||
47 | |||||
48 | my $end = $doc->find_first('PPI::Statement::End'); | ||||
49 | if ($end) { # No __END__ means definite violation | ||||
50 | my $pod_loc = $pod->location(); | ||||
51 | my $end_loc = $end->location(); | ||||
52 | if ( $pod_loc->[0] > $end_loc->[0] ) { | ||||
53 | # POD is after __END__, or relative position couldn't be determined | ||||
54 | return; | ||||
55 | } | ||||
56 | } | ||||
57 | |||||
58 | return $self->violation( $DESC, $EXPL, $pod ); | ||||
59 | } | ||||
60 | |||||
61 | 1 | 4µs | 1; | ||
62 | |||||
63 | __END__ | ||||
# spent 2µs within Perl::Critic::Policy::Documentation::RequirePodAtEnd::CORE:qr which was called:
# once (2µs+0s) by Module::Pluggable::Object::_require at line 24 |