line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
5984
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
221
|
|
2
|
6
|
|
|
6
|
|
35
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
355
|
|
3
|
|
|
|
|
|
|
package Perl::Critic::Policy::Tics::ProhibitUseBase; |
4
|
|
|
|
|
|
|
# ABSTRACT: do not use base.pm |
5
|
|
|
|
|
|
|
$Perl::Critic::Policy::Tics::ProhibitUseBase::VERSION = '0.009'; |
6
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
7
|
|
|
|
|
|
|
#pod |
8
|
|
|
|
|
|
|
#pod use base qw(Baseclass); |
9
|
|
|
|
|
|
|
#pod |
10
|
|
|
|
|
|
|
#pod You've seen that a hundred times, right? That doesn't mean that it's a good |
11
|
|
|
|
|
|
|
#pod idea. It screws with C<$VERSION>, it alters (for the worse) the exceptions |
12
|
|
|
|
|
|
|
#pod reported by failure-to-require, it doesn't let you call the base class's |
13
|
|
|
|
|
|
|
#pod C<import> method, it pushes to C<@INC> rather than replacing it, and it uses |
14
|
|
|
|
|
|
|
#pod and documents interactions with L<fields|fields>, which can lead one to believe |
15
|
|
|
|
|
|
|
#pod that fields are even remotely relevant to modern (or any!) development of Perl |
16
|
|
|
|
|
|
|
#pod classes. |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod There are a lot of ways around using C<base>. Pick one. |
19
|
|
|
|
|
|
|
#pod |
20
|
|
|
|
|
|
|
#pod =head1 WARNING |
21
|
|
|
|
|
|
|
#pod |
22
|
|
|
|
|
|
|
#pod This policy caused a bit of controversy, largely in this form: |
23
|
|
|
|
|
|
|
#pod |
24
|
|
|
|
|
|
|
#pod These behaviors are either correct or can be worked around, and using base.pm |
25
|
|
|
|
|
|
|
#pod protects you from the problem of remembering to load prereqs and from |
26
|
|
|
|
|
|
|
#pod setting @INC at runtime. |
27
|
|
|
|
|
|
|
#pod |
28
|
|
|
|
|
|
|
#pod These are true statements. My chosen workaround for all these problems is to |
29
|
|
|
|
|
|
|
#pod I<not use base.pm>. That doesn't mean it's a good idea for you, or anyone |
30
|
|
|
|
|
|
|
#pod else. Heck, it doesn't mean it's a good idea for me, either. It's just my |
31
|
|
|
|
|
|
|
#pod preference. As with all Perl::Critic policies, you should decide whether it's |
32
|
|
|
|
|
|
|
#pod right for you. |
33
|
|
|
|
|
|
|
#pod |
34
|
|
|
|
|
|
|
#pod =cut |
35
|
|
|
|
|
|
|
|
36
|
6
|
|
|
6
|
|
34
|
use Perl::Critic::Utils; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
142
|
|
37
|
6
|
|
|
6
|
|
8423
|
use parent qw(Perl::Critic::Policy); |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
95
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $DESCRIPTION = q{Use of "base" pragma}; |
40
|
|
|
|
|
|
|
my $EXPLANATION = q{Don't use base, set @INC or use a base.pm alternative.}; |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
2
|
1
|
29
|
sub default_severity { $SEVERITY_LOW } |
43
|
0
|
|
|
0
|
1
|
0
|
sub default_themes { qw(tics) } |
44
|
3
|
|
|
3
|
1
|
31553
|
sub applies_to { 'PPI::Statement::Include' } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub violates { |
47
|
3
|
|
|
3
|
1
|
54
|
my ($self, $elem, $doc) = @_; |
48
|
|
|
|
|
|
|
|
49
|
3
|
100
|
|
|
|
16
|
return unless $elem->module eq 'base'; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# Must be a violation... |
52
|
2
|
|
|
|
|
63
|
return $self->violation($DESCRIPTION, $EXPLANATION, $elem); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=pod |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=encoding UTF-8 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 NAME |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Perl::Critic::Policy::Tics::ProhibitUseBase - do not use base.pm |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 VERSION |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
version 0.009 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 DESCRIPTION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
use base qw(Baseclass); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
You've seen that a hundred times, right? That doesn't mean that it's a good |
76
|
|
|
|
|
|
|
idea. It screws with C<$VERSION>, it alters (for the worse) the exceptions |
77
|
|
|
|
|
|
|
reported by failure-to-require, it doesn't let you call the base class's |
78
|
|
|
|
|
|
|
C<import> method, it pushes to C<@INC> rather than replacing it, and it uses |
79
|
|
|
|
|
|
|
and documents interactions with L<fields|fields>, which can lead one to believe |
80
|
|
|
|
|
|
|
that fields are even remotely relevant to modern (or any!) development of Perl |
81
|
|
|
|
|
|
|
classes. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
There are a lot of ways around using C<base>. Pick one. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 WARNING |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This policy caused a bit of controversy, largely in this form: |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
These behaviors are either correct or can be worked around, and using base.pm |
90
|
|
|
|
|
|
|
protects you from the problem of remembering to load prereqs and from |
91
|
|
|
|
|
|
|
setting @INC at runtime. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
These are true statements. My chosen workaround for all these problems is to |
94
|
|
|
|
|
|
|
I<not use base.pm>. That doesn't mean it's a good idea for you, or anyone |
95
|
|
|
|
|
|
|
else. Heck, it doesn't mean it's a good idea for me, either. It's just my |
96
|
|
|
|
|
|
|
preference. As with all Perl::Critic policies, you should decide whether it's |
97
|
|
|
|
|
|
|
right for you. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Ricardo SIGNES <rjbs@cpan.org> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Ricardo SIGNES. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
108
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |