File Coverage

blib/lib/Perl/Critic/Policy/Miscellanea/ProhibitFormats.pm
Criterion Covered Total %
statement 23 25 92.0
branch 1 4 25.0
condition n/a
subroutine 11 11 100.0
pod 4 5 80.0
total 39 45 86.6


line stmt bran cond sub pod time code
1             package Perl::Critic::Policy::Miscellanea::ProhibitFormats;
2              
3 40     40   23914 use 5.010001;
  40         137  
4 40     40   175 use strict;
  40         74  
  40         965  
5 40     40   146 use warnings;
  40         76  
  40         1553  
6 40     40   162 use Readonly;
  40         79  
  40         2278  
7              
8 40     40   196 use Perl::Critic::Utils qw{ :severities :classification };
  40         87  
  40         2078  
9 40     40   11962 use parent 'Perl::Critic::Policy';
  40         79  
  40         207  
10              
11             our $VERSION = '1.156';
12              
13             #-----------------------------------------------------------------------------
14              
15             Readonly::Scalar my $DESC => q{Format used};
16             Readonly::Scalar my $EXPL => [ 449 ];
17              
18             #-----------------------------------------------------------------------------
19              
20 90     90 0 1793 sub supported_parameters { return () }
21 75     75 1 241 sub default_severity { return $SEVERITY_MEDIUM }
22 86     86 1 276 sub default_themes { return qw( core maintenance pbp certrule ) }
23 31     31 1 63 sub applies_to { return 'PPI::Token::Word' }
24              
25             #-----------------------------------------------------------------------------
26              
27             sub violates {
28 332     332 1 426 my ( $self, $elem, undef ) = @_;
29 332 50       454 return if $elem->content() ne 'format';
30 0 0         return if ! is_function_call( $elem );
31 0           return $self->violation( $DESC, $EXPL, $elem );
32             }
33              
34              
35             1;
36              
37             __END__
38              
39             #-----------------------------------------------------------------------------
40              
41             =pod
42              
43             =head1 NAME
44              
45             Perl::Critic::Policy::Miscellanea::ProhibitFormats - Do not use C<format>.
46              
47              
48             =head1 AFFILIATION
49              
50             This Policy is part of the core L<Perl::Critic|Perl::Critic>
51             distribution.
52              
53              
54             =head1 DESCRIPTION
55              
56             Formats are one of the oldest features of Perl. Unfortunately, they
57             suffer from several limitations. Formats are static and cannot be
58             easily defined at run time. Also, formats depend on several obscure
59             global variables.
60              
61             For more modern reporting tools, consider using one of the template
62             frameworks like L<Template|Template> or try the
63             L<Perl6::Form|Perl6::Form> module.
64              
65              
66             =head1 CONFIGURATION
67              
68             This Policy is not configurable except for the standard options.
69              
70              
71             =head1 AUTHOR
72              
73             Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
74              
75             =head1 COPYRIGHT
76              
77             Copyright (c) 2005-2011 Imaginative Software Systems. All rights reserved.
78              
79             This program is free software; you can redistribute it and/or modify
80             it under the same terms as Perl itself. The full text of this license
81             can be found in the LICENSE file included with this module.
82              
83             =cut
84              
85             # Local Variables:
86             # mode: cperl
87             # cperl-indent-level: 4
88             # fill-column: 78
89             # indent-tabs-mode: nil
90             # c-indentation-style: bsd
91             # End:
92             # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :