## name Basic passing
## failures 0
## cut
@x = (@y, @z);
my $expl = [133, 138];
$lookup = { a => 1, b => 2 };
#-----------------------------------------------------------------------------
## name Basic failure
## failures 1
## cut
@x = @y, @z;
#-----------------------------------------------------------------------------
## name List including assignments
## failures 0
## cut
@w = ($x = 1, $y = 2, $z = 3);
#-----------------------------------------------------------------------------
## name List containing statement
## failures 0
## cut
@w = ( {}, [] );
#-----------------------------------------------------------------------------
## name List containing statement in a constructor that is reported as a block
## failures 0
## cut
my %foo = (
blah => {
blah => 'blah',
},
);
#-----------------------------------------------------------------------------
## name Regular statement inside a block.
## failures 0
## cut
foreach my $path ( @ARGV ) {
utter 'Looking at ', $path, '.';
}
#-----------------------------------------------------------------------------
## name Sub call after comma
## failures 1
## cut
@x = @y, foo @z;
#-----------------------------------------------------------------------------
## name Regular sub call before comma
## failures 1
## cut
# The space between the sub name and the left parenthesis is significant
# in that part of Conway's point is that things that look like lists may
# not be.
@x = foo (@y), @z;
#-----------------------------------------------------------------------------
## name No-argument sub call via use of sigil
## failures 1
## cut
@x = &foo, @y, bar @z;
#-----------------------------------------------------------------------------
## name Two sub calls
## failures 0
## cut
@x = foo @y, bar @z;
#-----------------------------------------------------------------------------
## name Built-in call that provides a list context without parentheses
## failures 0
## cut
@x = push @y, @z;
#-----------------------------------------------------------------------------
## name Built-in call that provides a list context, called like a function
## failures 1
## cut
@x = push (@y), @z;
#-----------------------------------------------------------------------------
## name Built-in call that takes multiple arguments without parentheses
## failures 0
## cut
@x = substr $y, 1, 2;
#-----------------------------------------------------------------------------
## name Built-in call that takes multiple arguments, called like a function
## failures 1
## cut
@x = substr ($y, 1), 2;
#-----------------------------------------------------------------------------
## name Call to unary built-in without parentheses
## failures 1
## cut
@x = tied @y, @z;
#-----------------------------------------------------------------------------
## name Unary built-in, called like a function
## failures 1
## cut
@x = tied (@y), @z;
#-----------------------------------------------------------------------------
## name Call to no-argument built-in without parentheses
## failures 1
## cut
@x = time, @z;
#-----------------------------------------------------------------------------
## name No-argument built-in, called like a function
## failures 1
## cut
@x = time (), @z;
#-----------------------------------------------------------------------------
## name Call to optional argument built-in without an argument without parentheses
## failures 1
## cut
@x = sin, @z;
#-----------------------------------------------------------------------------
## name Optional argument built-in, called like a function without an argument
## failures 1
## cut
@x = sin (), @z;
#-----------------------------------------------------------------------------
## name Call to optional argument built-in with an argument without parentheses
## failures 1
## cut
@x = sin @y, @z;
#-----------------------------------------------------------------------------
## name Optional argument built-in, called like a function with an argument
## failures 1
## cut
@x = sin (@y), @z;
#-----------------------------------------------------------------------------
## name For loop
## failures 2
## cut
for ($x = 0, $y = 0; $x < 10; $x++, $y += 2) {
foo($x, $y);
}
#-----------------------------------------------------------------------------
## name For loop
## failures 0
## cut
for ($x, 'x', @y, 1, ) {
print;
}
#-----------------------------------------------------------------------------
## name qw<>
## failures 0
## cut
@list = qw<1, 2, 3>; # this really means @list = ('1,', '2,', '3');
#-----------------------------------------------------------------------------
## name original RT #27654
## failures 0
## cut
my @arr1;
@arr1 = split /b/, 'abc';
#-----------------------------------------------------------------------------
## name RT #27654 - NKH example 1
## failures 0
## cut
return
{
"string" => $aliased_history,
TIME => $self->{something},
} ;
#-----------------------------------------------------------------------------
## name RT #27654 - NKH example 2 - without allow_last_statement_to_be_comma_separated_in_map_and_grep
## failures 1
## cut
%hash = map {$_, 1} @list ;
#-----------------------------------------------------------------------------
## name RT #27654 - NKH example 2 - with allow_last_statement_to_be_comma_separated_in_map_and_grep
## failures 0
## parms { allow_last_statement_to_be_comma_separated_in_map_and_grep => 1 }
## cut
%hash = map {$_, 1} @list ;
#-----------------------------------------------------------------------------
## name RT #27654 - NKH example 3
## failures 0
## TODO PPI parses this code as blocks and not hash constructors.
## cut
$self->DoSomething
(
{ %{$a_hash_ref}, %{$another_hash_ref}},
@more_data,
) ;
#-----------------------------------------------------------------------------
## name RT #33935 and 49679
## failures 0
## cut
func( @{ $href }{'1', '2'} );
#-----------------------------------------------------------------------------
## name RT #61301 (requires PPI 1.215)
## failures 0
## cut
sub foo {
return { bar => 1, answer => 42 };
}
#-----------------------------------------------------------------------------
## name RT #64132 (requires PPI 1.215)
## failures 0
## cut
sub new {
return bless { foo => 1, bar => 2 }, __PACKAGE__;
}
#-----------------------------------------------------------------------------
##############################################################################
# $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic/t/ValuesAndExpressions/ProhibitCommaSeparatedStatements.run $
# $Date: 2012-07-02 23:28:32 -0700 (Mon, 02 Jul 2012) $
# $Author: thaljef $
# $Revision: 4130 $
##############################################################################
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 78
# indent-tabs-mode: nil
# c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :