8d526cd2538f4d94c249a61bb716bf01074be7d8
[dh-make-perl] / dev / i386 / libperl-critic-perl / libperl-critic-perl-1.088 / t / Modules / ProhibitExcessMainComplexity.run
1 ##############################################################################
2 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/Modules/ProhibitExcessMainComplexity.run $
3 #     $Date: 2008-03-16 17:40:45 -0500 (Sun, 16 Mar 2008) $
4 #   $Author: clonezone $
5 # $Revision: 2187 $
6 ##############################################################################
7
8 #-----------------------------------------------------------------------------
9
10 ## name param-based failure
11 ## failures 0
12 ## parms { max_mccabe => 100 }
13 ## cut
14
15 if ( $foo && $bar || $baz ) {
16   open my $fh, '<', $file or die $!;
17 }
18 elsif ( $blah >>= some_function() ) {
19   return if $barf;
20 }
21 else {
22   $results = $condition ? 1 : 0;
23 }
24 croak unless $result;
25
26 while( $condition ){ frobulate() }
27 until( $foo > $baz ){ blech() }
28
29 #-----------------------------------------------------------------------------
30
31 ## name parm-based failure
32 ## failures 1
33 ## parms { max_mccabe => 1 }
34 ## cut
35
36
37 if ( $foo && $bar || $baz ) {
38   open my $fh, '<', $file or die $!;
39 }
40 elsif ( $blah >>= some_function() ) {
41   return if $barf;
42 }
43 else {
44   $results = $condition ? 1 : 0;
45 }
46
47 croak unless $result;
48
49 #-----------------------------------------------------------------------------
50
51 ## name exclude code inside subroutines
52 ## failures 0
53 ## parms { max_mccabe => 2 }
54 ## cut
55
56 sub foo {
57     if ( $foo && $bar || $baz ) {
58         open my $fh, '<', $file or die $!;
59     }
60     elsif ( $blah >>= some_function() ) {
61         return if $barf;
62     }
63     else {
64         $results = $condition ? 1 : 0;
65     }
66
67     croak unless $result;
68 }
69
70 #main code here!
71 die if $condition;
72
73 sub bar {
74     if ( $foo && $bar || $baz ) {
75         open my $fh, '<', $file or die $!;
76     }
77     elsif ( $blah >>= some_function() ) {
78         return if $barf;
79     }
80     else {
81         $results = $condition ? 1 : 0;
82     }
83
84     croak unless $result;
85 }
86
87 #-----------------------------------------------------------------------------
88
89 ## name empty module
90 ## failures 0
91 ## cut
92
93 ##############################################################################
94 # Local Variables:
95 #   mode: cperl
96 #   cperl-indent-level: 4
97 #   fill-column: 78
98 #   indent-tabs-mode: nil
99 #   c-indentation-style: bsd
100 # End:
101 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
102