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   26660 use 5.010001;
  40         183  
4 40     40   304 use strict;
  40         126  
  40         816  
5 40     40   254 use warnings;
  40         129  
  40         921  
6 40     40   251 use Readonly;
  40         115  
  40         1911  
7              
8 40     40   271 use Perl::Critic::Utils qw{ :severities :classification };
  40         129  
  40         1971  
9 40     40   13354 use parent 'Perl::Critic::Policy';
  40         146  
  40         290  
10              
11             our $VERSION = '1.150';
12              
13             #-----------------------------------------------------------------------------
14              
15             Readonly::Scalar my $DESC => q{Format used};
16             Readonly::Scalar my $EXPL => [ 449 ];
17              
18             #-----------------------------------------------------------------------------
19              
20 89     89 0 1599 sub supported_parameters { return () }
21 74     74 1 320 sub default_severity { return $SEVERITY_MEDIUM }
22 86     86 1 446 sub default_themes { return qw( core maintenance pbp certrule ) }
23 30     30 1 86 sub applies_to { return 'PPI::Token::Word' }
24              
25             #-----------------------------------------------------------------------------
26              
27             sub violates {
28 329     329 1 504 my ( $self, $elem, undef ) = @_;
29 329 50       507 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 :