10 # These ones deliberately omit the semi-colon
14 #-----------------------------------------------------------------------------
29 my_subroutine($foo $bar);
30 {print}; # for Devel::Cover
32 #-----------------------------------------------------------------------------
34 ## name Method invocation
38 my $obj = SomeClass->new();
44 is( pcritique($policy, \$code), 0, $policy);
46 #-----------------------------------------------------------------------------
48 ## name Parentheses with unary operators
52 $foo = int( 0.5 ) + 1.5;
53 $foo = int( 0.5 ) - 1.5;
54 $foo = int( 0.5 ) * 1.5;
55 $foo = int( 0.5 ) / 1.5;
56 $foo = int( 0.5 ) ** 1.5;
58 $foo = oct( $foo ) + 1;
59 $foo = ord( $foo ) - 1;
60 $foo = sin( $foo ) * 2;
61 $foo = uc( $foo ) . $bar;
62 $foo = lc( $foo ) . $bar;
64 #-----------------------------------------------------------------------------
70 print substr($foo, 2, 3), "\n";
71 if ( unpack('V', $foo) == 2 ) { }
73 #-----------------------------------------------------------------------------
75 ## name Parentheses with greedy functions
79 substr join( $delim, @list), $offset, $length;
80 print reverse( $foo, $bar, $baz), $nuts;
81 sort map( {some_func($_)} @list1 ), @list2;
83 #-----------------------------------------------------------------------------
85 ## name Test cases from RT
89 chomp( my $foo = <STDIN> );
90 defined( my $child = shift @free_children )
91 return ( $start_time + $elapsed_hours ) % $hours_in_day;
93 #-----------------------------------------------------------------------------
95 ## name High-precedence operator after parentheses
99 grep( { do_something($_) }, @list ) + 3;
100 join( $delim, @list ) . "\n";
101 pack( $template, $foo, $bar ) . $suffix;
102 chown( $file1, $file2 ) || die q{Couldn't chown};
104 #-----------------------------------------------------------------------------
106 ## name Low-precedence operator after parentheses
110 grep( { do_something($_) }, $foo, $bar) and do_something();
111 chown( $file1, $file2 ) or die q{Couldn't chown};
113 #-----------------------------------------------------------------------------
115 ## name Handling sort having subroutine name as an argument
120 [ sort ( modules_used_in_string( $code ) ) ]
122 #-----------------------------------------------------------------------------
124 ##############################################################################
125 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/CodeLayout/ProhibitParensWithBuiltins.run $
126 # $Date: 2008-06-17 01:11:23 -0500 (Tue, 17 Jun 2008) $
127 # $Author: chrisdolan $
129 ##############################################################################
133 # cperl-indent-level: 4
135 # indent-tabs-mode: nil
136 # c-indentation-style: bsd
138 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :