Login
More self-compliance.
[gknop/Perl-Critic.git] / lib / Perl / Critic / Policy / ClassHierarchies / ProhibitExplicitISA.pm
CommitLineData
6036a254 1##############################################################################
fc1186f9
CD
2# $URL$
3# $Date$
4# $Author$
5# $Revision$
6036a254 6##############################################################################
fc1186f9
CD
7
8package Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA;
9
df6dee2b 10use 5.006001;
fc1186f9
CD
11use strict;
12use warnings;
c680a9c9
ES
13use Readonly;
14
bbf4108c 15use Perl::Critic::Utils qw{ :severities };
fc1186f9
CD
16use base 'Perl::Critic::Policy';
17
173667ce 18our $VERSION = '1.093_01';
fc1186f9 19
6036a254 20#-----------------------------------------------------------------------------
fc1186f9 21
6e283e81 22Readonly::Scalar my $DESC => q{@ISA used instead of "use base"}; ## no critic (RequireInterpolation)
c680a9c9 23Readonly::Scalar my $EXPL => [ 360 ];
fc1186f9 24
6036a254 25#-----------------------------------------------------------------------------
fc1186f9 26
c680a9c9
ES
27sub supported_parameters { return () }
28sub default_severity { return $SEVERITY_MEDIUM }
29sub default_themes { return qw( core maintenance pbp ) }
30sub applies_to { return 'PPI::Token::Symbol' }
fc1186f9 31
6036a254 32#-----------------------------------------------------------------------------
fc1186f9
CD
33
34sub violates {
e5f6c18d
AL
35 my ($self, $elem, undef) = @_;
36
6e283e81 37 if( $elem eq q{@ISA} ) { ## no critic (RequireInterpolation)
c680a9c9 38 return $self->violation( $DESC, $EXPL, $elem );
fc1186f9
CD
39 }
40 return; #ok!
41}
42
431;
44
6036a254 45#-----------------------------------------------------------------------------
fc1186f9
CD
46
47__END__
48
49=pod
50
51=head1 NAME
52
09a3355f 53Perl::Critic::Policy::ClassHierarchies::ProhibitExplicitISA - Employ C<use base> instead of C<@ISA>.
fc1186f9 54
11f53956 55
af93c316
ES
56=head1 AFFILIATION
57
11f53956
ES
58This Policy is part of the core L<Perl::Critic|Perl::Critic>
59distribution.
af93c316
ES
60
61
fc1186f9
CD
62=head1 DESCRIPTION
63
64Conway recommends employing C<use base qw(Foo)> instead of the usual
65C<our @ISA = qw(Foo)> because the former happens at compile time and
66the latter at runtime. The C<base> pragma also automatically loads
67C<Foo> for you so you save a line of easily-forgotten code.
68
0cb729f0
ES
69
70=head1 CONFIGURATION
71
49860482 72This Policy is not configurable except for the standard options.
0cb729f0
ES
73
74
fc1186f9
CD
75=head1 AUTHOR
76
77Chris Dolan <cdolan@cpan.org>
78
11f53956 79
fc1186f9
CD
80=head1 COPYRIGHT
81
82Copyright (C) 2006 Chris Dolan. All rights reserved.
83
84This program is free software; you can redistribute it and/or modify
85it under the same terms as Perl itself.
86
87=cut
737d3b65
CD
88
89# Local Variables:
90# mode: cperl
91# cperl-indent-level: 4
92# fill-column: 78
93# indent-tabs-mode: nil
94# c-indentation-style: bsd
95# End:
96fed375 96# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :