Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / t / ControlStructures / ProhibitPostfixControls.run
1 ## name Basic failure
2 ## failures 6
3 ## cut
4
5 do_something() if $condition;
6 do_something() while $condition;
7 do_something() until $condition;
8 do_something() unless $condition;
9 do_something() for @list;
10 do_something() foreach @list;
11
12 #-----------------------------------------------------------------------------
13
14 ## name Configured to allow all
15 ## failures 0
16 ## parms {allow => 'if while until unless for foreach'}
17 ## cut
18
19 do_something() if $condition;
20 do_something() while $condition;
21 do_something() until $condition;
22 do_something() unless $condition;
23 do_something() for @list;
24 do_something() foreach @list;
25
26 #-----------------------------------------------------------------------------
27
28 ## name Configured to allow all, all regular control structures
29 ## failures 0
30 ## parms {allow => 'if unless until while'}
31 ## cut
32
33 if($condition){ do_something() }
34 while($condition){ do_something() }
35 until($condition){ do_something() }
36 unless($condition){ do_something() }
37
38 #-----------------------------------------------------------------------------
39
40 ## name Regular for loops
41 ## failures 0
42 ## cut
43
44 #PPI versions < 1.03 had problems with this
45 for my $element (@list){ do_something() }
46 for (@list){ do_something_else() }
47 foreach my $element (@list){ do_something() }
48 foreach (@list){ do_something_else() }
49
50 #-----------------------------------------------------------------------------
51
52 ## name Legal postfix usage
53 ## failures 0
54 ## cut
55
56 use Carp;
57
58 while ($condition) {
59     next if $condition;
60     last if $condition;
61     redo if $condition;
62     return if $condition;
63     goto HELL if $condition;
64     exit if $condition;
65 }
66
67 die 'message' if $condition;
68 die if $condition;
69
70 warn 'message' if $condition;
71 warn if $condition;
72
73 carp 'message' if $condition;
74 carp if $condition;
75
76 croak 'message' if $condition;
77 croak if $condition;
78
79 cluck 'message' if $condition;
80 cluck if $condition;
81
82 confess 'message' if $condition;
83 confess if $condition;
84
85 exit 0 if $condition;
86 exit if $condition;
87
88 #-----------------------------------------------------------------------------
89
90 ## name override exempt flowcontrols
91 ## failures 0
92 ## parms {flowcontrol => 'assert'}
93 ## cut
94
95 use Carp::Assert;
96
97 assert $something if $condition;
98
99
100 #-----------------------------------------------------------------------------
101
102 ## name overriding exempt flowcontrols restores the defaults
103 ## failures 8
104 ## parms {flowcontrol => 'assert'}
105 ## cut
106
107 use Carp::Assert;
108
109 warn    $something if $condition;
110 die     $something if $condition;
111 carp    $something if $condition;
112 croak   $something if $condition;
113 cluck   $something if $condition;
114 confess $something if $condition;
115 exit    $something if $condition;
116 do_something() if $condition;
117
118 #-----------------------------------------------------------------------------
119
120 ## name Individual "keyword" hash assignment
121 ## failures 0
122 ## cut
123
124 my %hash;
125 $hash{if} = 1;
126 $hash{unless} = 1;
127 $hash{until} = 1;
128 $hash{while} = 1;
129 $hash{for} = 1;
130 $hash{foreach} = 1;
131
132 #-----------------------------------------------------------------------------
133
134 ## name "Keyword"-list hash assignment
135 ## failures 0
136 ## cut
137
138 my %hash = (
139     if => 1,
140     unless => 1,
141     until => 1,
142     while => 1,
143     for => 1,
144     foreach => 1,
145 );
146
147 #-----------------------------------------------------------------------------
148
149 ##############################################################################
150 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/ControlStructures/ProhibitPostfixControls.run $
151 #     $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $
152 #   $Author: clonezone $
153 # $Revision: 2187 $
154 ##############################################################################
155
156 # Local Variables:
157 #   mode: cperl
158 #   cperl-indent-level: 4
159 #   fill-column: 78
160 #   indent-tabs-mode: nil
161 #   c-indentation-style: bsd
162 # End:
163 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :