Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / lib / Perl / Critic / Policy / ClassHierarchies / ProhibitAutoloading.pm
1 ##############################################################################
2 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ClassHierarchies/ProhibitAutoloading.pm $
3 #     $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $
4 #   $Author: clonezone $
5 # $Revision: 2489 $
6 ##############################################################################
7
8 package Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading;
9
10 use 5.006001;
11 use strict;
12 use warnings;
13 use Readonly;
14
15 use Perl::Critic::Utils qw{ :severities };
16 use base 'Perl::Critic::Policy';
17
18 our $VERSION = '1.088';
19
20 #-----------------------------------------------------------------------------
21
22 Readonly::Scalar my $DESC => q{AUTOLOAD method declared};
23 Readonly::Scalar my $EXPL => [ 393 ];
24
25 #-----------------------------------------------------------------------------
26
27 sub supported_parameters { return ()                         }
28 sub default_severity     { return $SEVERITY_MEDIUM           }
29 sub default_themes       { return qw( core maintenance pbp ) }
30 sub applies_to           { return 'PPI::Statement::Sub'      }
31
32 #-----------------------------------------------------------------------------
33
34 sub violates {
35     my ($self, $elem, undef) = @_;
36
37     if( $elem->name eq 'AUTOLOAD' ) {
38         return $self->violation( $DESC, $EXPL, $elem );
39     }
40     return; #ok!
41 }
42
43 1;
44
45 #-----------------------------------------------------------------------------
46
47 __END__
48
49 =pod
50
51 =head1 NAME
52
53 Perl::Critic::Policy::ClassHierarchies::ProhibitAutoloading - AUTOLOAD methods should be avoided.
54
55 =head1 AFFILIATION
56
57 This Policy is part of the core L<Perl::Critic> distribution.
58
59
60 =head1 DESCRIPTION
61
62 Declaring a subroutine with the name C<"AUTOLOAD"> will violate this
63 Policy.  The C<AUTOLOAD> mechanism is an easy way to generate methods
64 for your classes, but unless they are carefully written, those classes
65 are difficult to inherit from.  And over time, the C<AUTOLOAD> method
66 will become more and more complex as it becomes responsible for
67 dispatching more and more functions.  You're better off writing
68 explicit accessor methods.  Editor macros can help make this a little
69 easier.
70
71
72 =head1 CONFIGURATION
73
74 This Policy is not configurable except for the standard options.
75
76
77 =head1 AUTHOR
78
79 Jeffrey Ryan Thalhammer <thaljef@cpan.org>
80
81 =head1 COPYRIGHT
82
83 Copyright (C) 2006 Jeffrey Ryan Thalhammer.  All rights reserved.
84
85 This program is free software; you can redistribute it and/or modify
86 it under the same terms as Perl itself.
87
88 =cut
89
90 # Local Variables:
91 #   mode: cperl
92 #   cperl-indent-level: 4
93 #   fill-column: 78
94 #   indent-tabs-mode: nil
95 #   c-indentation-style: bsd
96 # End:
97 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :