line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
215158
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
5
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
5
|
use English qw(-no_match_vars); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
6
|
use base 'Perl::Critic::Policy'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
7
|
1
|
|
|
1
|
|
335
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
491
|
|
8
|
|
|
|
|
|
|
use Perl::Critic::Utils qw( |
9
|
1
|
|
|
|
|
44
|
:severities |
10
|
|
|
|
|
|
|
&hashify |
11
|
|
|
|
|
|
|
&policy_short_name |
12
|
|
|
|
|
|
|
); |
13
|
1
|
|
|
1
|
|
30456
|
|
|
1
|
|
|
|
|
3
|
|
14
|
|
|
|
|
|
|
use Perl::Critic::StricterSubs::Utils qw( |
15
|
1
|
|
|
|
|
374
|
&find_declared_constant_names |
16
|
|
|
|
|
|
|
&find_declared_subroutine_names |
17
|
|
|
|
|
|
|
&find_exported_subroutine_names |
18
|
|
|
|
|
|
|
); |
19
|
1
|
|
|
1
|
|
578
|
|
|
1
|
|
|
|
|
3
|
|
20
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = 0.06; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
6
|
|
|
6
|
0
|
21784
|
#----------------------------------------------------------------------------- |
28
|
5
|
|
|
5
|
1
|
49
|
|
29
|
0
|
|
|
0
|
1
|
0
|
my ($self, $elem, $doc) = @_; |
30
|
6
|
|
|
6
|
1
|
59456
|
|
31
|
|
|
|
|
|
|
my @exported_sub_names = (); |
32
|
|
|
|
|
|
|
eval { |
33
|
|
|
|
|
|
|
@exported_sub_names = find_exported_subroutine_names( $doc ); |
34
|
|
|
|
|
|
|
1; |
35
|
6
|
|
|
6
|
1
|
52
|
} or do { |
36
|
|
|
|
|
|
|
|
37
|
6
|
|
|
|
|
10
|
if ( $EVAL_ERROR =~ m/Found \s multiple/mxs ) { |
38
|
|
|
|
|
|
|
my $pname = policy_short_name(__PACKAGE__); |
39
|
6
|
|
|
|
|
16
|
my $fname = $doc->filename() || 'unknown'; |
40
|
6
|
|
|
|
|
21
|
warn qq{$pname: $EVAL_ERROR in file "$fname"\n}; |
41
|
6
|
50
|
|
|
|
10
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
0
|
|
|
|
0
|
|
44
|
0
|
|
|
|
|
0
|
}; |
45
|
0
|
|
0
|
|
|
0
|
|
46
|
0
|
|
|
|
|
0
|
my @declared_sub_names = find_declared_subroutine_names( $doc ); |
47
|
0
|
|
|
|
|
0
|
my @declared_constants = find_declared_constant_names( $doc ); |
48
|
|
|
|
|
|
|
my %declared_sub_names = hashify( @declared_sub_names, |
49
|
|
|
|
|
|
|
@declared_constants ); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my @violations = (); |
52
|
6
|
|
|
|
|
15
|
for my $sub_name ( @exported_sub_names ) { |
53
|
6
|
|
|
|
|
15
|
if ( not exists $declared_sub_names{ $sub_name } ){ |
54
|
6
|
|
|
|
|
17
|
my $desc = qq{Subroutine "$sub_name" is exported but not declared}; |
55
|
|
|
|
|
|
|
my $expl = qq{Perhaps you forgot to define "$sub_name"}; |
56
|
|
|
|
|
|
|
push @violations, $self->violation( $desc, $expl, $doc ); |
57
|
6
|
|
|
|
|
47
|
} |
58
|
6
|
|
|
|
|
11
|
} |
59
|
13
|
100
|
|
|
|
480
|
|
60
|
5
|
|
|
|
|
15
|
return @violations; |
61
|
5
|
|
|
|
|
10
|
} |
62
|
5
|
|
|
|
|
18
|
|
63
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
6
|
|
|
|
|
741
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=pod |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Perl::Critic::Policy::Subroutines::ProhibitExportingUndeclaredSubs |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AFFILIATION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This policy is part of L<Perl::Critic::StricterSubs|Perl::Critic::StricterSubs>. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 DESCRIPTION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This Policy checks that any subroutine listed in C<@EXPORT> or C<@EXPORT_OK> |
81
|
|
|
|
|
|
|
is actually defined in the current file. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 AUTHOR |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <thaljef@cpan.org> |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 COPYRIGHT |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Copyright (c) 2007 Jeffrey Ryan Thalhammer. All rights reserved. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under |
92
|
|
|
|
|
|
|
the same terms as Perl itself. The full text of this license can be found in |
93
|
|
|
|
|
|
|
the LICENSE file included with this module. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
############################################################################## |
99
|
|
|
|
|
|
|
# Local Variables: |
100
|
|
|
|
|
|
|
# mode: cperl |
101
|
|
|
|
|
|
|
# cperl-indent-level: 4 |
102
|
|
|
|
|
|
|
# fill-column: 78 |
103
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
104
|
|
|
|
|
|
|
# c-indentation-style: bsd |
105
|
|
|
|
|
|
|
# End: |
106
|
|
|
|
|
|
|
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab : |