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 / ValuesAndExpressions / RequireUpperCaseHeredocTerminator.pm
1 ##############################################################################
2 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Policy/ValuesAndExpressions/RequireUpperCaseHeredocTerminator.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::ValuesAndExpressions::RequireUpperCaseHeredocTerminator;
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 $HEREDOC_RX => qr{ \A << \s* (["|']?) [[:upper:]_] [[:upper:]\d_]* \1 \z }mx;
23 Readonly::Scalar my $DESC       => q{Heredoc terminator not alphanumeric and upper-case};
24 Readonly::Scalar my $EXPL       => [ 64 ];
25
26 #-----------------------------------------------------------------------------
27
28 sub supported_parameters { return ()                    }
29 sub default_severity     { return $SEVERITY_LOW         }
30 sub default_themes       { return qw(core pbp cosmetic) }
31 sub applies_to           { return 'PPI::Token::HereDoc' }
32
33 #-----------------------------------------------------------------------------
34
35 sub violates {
36     my ( $self, $elem, undef ) = @_;
37
38     if ( $elem !~ $HEREDOC_RX ) {
39         return $self->violation( $DESC, $EXPL, $elem );
40     }
41     return;    #ok!
42 }
43
44 1;
45
46 __END__
47
48 #-----------------------------------------------------------------------------
49
50 =pod
51
52 =head1 NAME
53
54 Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator - Write C< <<'THE_END'; > instead of C< <<'theEnd'; >.
55
56 =head1 AFFILIATION
57
58 This Policy is part of the core L<Perl::Critic> distribution.
59
60
61 =head1 DESCRIPTION
62
63 For legibility, HEREDOC terminators should be all UPPER CASE letters
64 (and numbers), without any whitespace.  Conway also recommends using a
65 standard prefix like "END_" but this policy doesn't enforce that.
66
67   print <<'the End';  #not ok
68   Hello World
69   the End
70
71   print <<'THE_END';  #ok
72   Hello World
73   THE_END
74
75
76 =head1 CONFIGURATION
77
78 This Policy is not configurable except for the standard options.
79
80
81 =head1 SEE ALSO
82
83 L<Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator>
84
85 =head1 AUTHOR
86
87 Jeffrey Ryan Thalhammer <thaljef@cpan.org>
88
89 =head1 COPYRIGHT
90
91 Copyright (c) 2005-2008 Jeffrey Ryan Thalhammer.  All rights reserved.
92
93 This program is free software; you can redistribute it and/or modify
94 it under the same terms as Perl itself.  The full text of this license
95 can be found in the LICENSE file included with this module.
96
97 =cut
98
99 # Local Variables:
100 #   mode: cperl
101 #   cperl-indent-level: 4
102 #   fill-column: 78
103 #   indent-tabs-mode: nil
104 #   c-indentation-style: bsd
105 # End:
106 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :