Login
Created a new Policy to prohibit an unrestricted ## no critic.
[gknop/Perl-Critic.git] / lib / Perl / Critic / Policy / Miscellanea / ProhibitFormats.pm
CommitLineData
6036a254 1##############################################################################
f8966b15 2# $URL$
dc93df4f 3# $Date$
f8966b15
JRT
4# $Author$
5# $Revision$
6036a254 6##############################################################################
f8966b15
JRT
7
8package Perl::Critic::Policy::Miscellanea::ProhibitFormats;
9
df6dee2b 10use 5.006001;
f8966b15
JRT
11use strict;
12use warnings;
c680a9c9
ES
13use Readonly;
14
bbf4108c 15use Perl::Critic::Utils qw{ :severities :classification };
f8966b15
JRT
16use base 'Perl::Critic::Policy';
17
173667ce 18our $VERSION = '1.093_01';
f8966b15 19
6036a254 20#-----------------------------------------------------------------------------
f8966b15 21
c680a9c9
ES
22Readonly::Scalar my $DESC => q{Format used};
23Readonly::Scalar my $EXPL => [ 449 ];
f8966b15 24
6036a254 25#-----------------------------------------------------------------------------
f8966b15 26
e178fe38 27sub supported_parameters { return () }
c680a9c9
ES
28sub default_severity { return $SEVERITY_MEDIUM }
29sub default_themes { return qw( core maintenance pbp ) }
30sub applies_to { return 'PPI::Token::Word' }
f8966b15 31
6036a254 32#-----------------------------------------------------------------------------
f8966b15
JRT
33
34sub violates {
e5f6c18d 35 my ( $self, $elem, undef ) = @_;
3006581f
JRT
36 return if $elem ne 'format';
37 return if ! is_function_call( $elem );
c680a9c9 38 return $self->violation( $DESC, $EXPL, $elem );
f8966b15
JRT
39}
40
41
421;
43
44__END__
45
6036a254 46#-----------------------------------------------------------------------------
f8966b15
JRT
47
48=pod
49
50=head1 NAME
51
3e68cfe8 52Perl::Critic::Policy::Miscellanea::ProhibitFormats - Do not use C<format>.
f8966b15 53
11f53956 54
af93c316
ES
55=head1 AFFILIATION
56
11f53956
ES
57This Policy is part of the core L<Perl::Critic|Perl::Critic>
58distribution.
af93c316
ES
59
60
f8966b15
JRT
61=head1 DESCRIPTION
62
11f53956
ES
63Formats are one of the oldest features of Perl. Unfortunately, they
64suffer from several limitations. Formats are static and cannot be
65easily defined at run time. Also, formats depend on several obscure
66global variables.
f8966b15 67
11f53956
ES
68For more modern reporting tools, consider using one of the template
69frameworks like L<Template|Template> or try the
70L<Perl6::Form|Perl6::Form> module.
f8966b15 71
0cb729f0
ES
72
73=head1 CONFIGURATION
74
49860482 75This Policy is not configurable except for the standard options.
0cb729f0
ES
76
77
f8966b15
JRT
78=head1 AUTHOR
79
80Jeffrey Ryan Thalhammer <thaljef@cpan.org>
81
82=head1 COPYRIGHT
83
20dfddeb 84Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer. All rights reserved.
f8966b15
JRT
85
86This program is free software; you can redistribute it and/or modify
87it under the same terms as Perl itself. The full text of this license
88can be found in the LICENSE file included with this module.
89
90=cut
737d3b65
CD
91
92# Local Variables:
93# mode: cperl
94# cperl-indent-level: 4
95# fill-column: 78
96# indent-tabs-mode: nil
97# c-indentation-style: bsd
98# End:
96fed375 99# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :