Build all packages removed dependencies of libtest-exception-perl libtest-warn-perl...
[dh-make-perl] / dev / i386 / libperl-critic-perl / libperl-critic-perl-1.088 / t / Variables / ProhibitConditionalDeclarations.run
1 ## name With if
2 ## failures 4
3 ## cut
4
5 my $foo = 1 if $bar;
6 our $foo = 1 if $bar;
7
8 my ($foo, $baz) = @list if $bar;
9 our ($foo, $baz) = 1 if $bar;
10
11
12 #-----------------------------------------------------------------------------
13
14 ## name With unless
15 ## failures 4
16 ## cut
17
18 my $foo = 1 unless $bar;
19 our $foo = 1 unless $bar;
20
21 my ($foo, $baz) = @list unless $bar;
22 our ($foo, $baz) = 1 unless $bar;
23
24
25 #-----------------------------------------------------------------------------
26
27 ## name With while
28 ## failures 4
29 ## cut
30
31 my $foo = 1 while $bar;
32 our $foo = 1 while $bar;
33
34 my ($foo, $baz) = @list while $bar;
35 our ($foo, $baz) = 1 while $bar;
36
37 #-----------------------------------------------------------------------------
38
39 ## name With for
40 ## failures 4
41 ## cut
42
43 my $foo = 1 for @bar;
44 our $foo = 1 for @bar;
45
46 my ($foo, $baz) = @list for @bar;
47 our ($foo, $baz) = 1 for @bar;
48
49 #-----------------------------------------------------------------------------
50
51 ## name With foreach
52 ## failures 4
53 ## cut
54
55 my $foo = 1 foreach @bar;
56 our $foo = 1 foreach @bar;
57
58 my ($foo, $baz) = @list foreach @bar;
59 our ($foo, $baz) = 1 foreach @bar;
60
61 #-----------------------------------------------------------------------------
62
63 ## name Passing cases
64 ## failures 0
65 ## cut
66
67 for my $foo (@list) { do_something() }
68 foreach my $foo (@list) { do_something() }
69 while (my $foo $condition) { do_something() }
70 until (my $foo = $condition) { do_something() }
71 unless (my $foo = $condition) { do_something() }
72
73 # these are terrible uses of "if" but do not violate the policy
74 my $foo = $hash{if};
75 my $foo = $obj->if();
76
77 #-----------------------------------------------------------------------------
78
79 ## name local is exempt
80 ## failures 0
81 ## cut
82
83 local $foo = $bar if $baz;
84 local ($foo) = $bar if $baz;
85 local $foo = $bar unless $baz;
86 local ($foo) = $bar unless $baz;
87 local $foo = $bar until $baz;
88 local ($foo) = $bar until $baz;
89 local ($foo, $bar) = 1 foreach @baz; 
90 local ($foo, $bar) = 1 for @baz;
91
92 ##############################################################################
93 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/Variables/ProhibitConditionalDeclarations.run $
94 #     $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $
95 #   $Author: clonezone $
96 # $Revision: 2187 $
97 ##############################################################################
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 :