Subject: | PPI incorrectly treats the {} in do_something({ %options }) as a block |
PPI incorrectly treats the {} in do_something({ %options }) as a block not a hash constructor. This causes Perl::Critic to complain about "Comma used to separate statements".
perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-thread-multi
perl -MPPI -E 'say $PPI::VERSION'
1.215
perl -MPPI::Document -MPPI::Dumper -e 'PPI::Dumper->new( PPI::Document->new(\"do_something({ %options, options => 1 });") )->print'
PPI::Document
PPI::Statement
PPI::Token::Word 'do_something'
PPI::Structure::List ( ... )
PPI::Statement::Compound
PPI::Structure::Block { ... }
PPI::Token::Whitespace ' '
PPI::Statement
PPI::Token::Symbol '%options'
PPI::Token::Operator ','
PPI::Token::Whitespace ' '
PPI::Token::Word 'options'
PPI::Token::Whitespace ' '
PPI::Token::Operator '=>'
PPI::Token::Whitespace ' '
PPI::Token::Number '1'
PPI::Token::Whitespace ' '
PPI::Token::Structure ';'
versus this which makes it a constructor as expected.
perl -MPPI::Document -MPPI::Dumper -e 'PPI::Dumper->new( PPI::Document->new(\"do_something(+{ %options, options => 1 });") )->print'
PPI::Document
PPI::Statement
PPI::Token::Word 'do_something'
PPI::Structure::List ( ... )
PPI::Statement::Expression
PPI::Token::Operator '+'
PPI::Structure::Constructor { ... }
PPI::Token::Whitespace ' '
PPI::Statement
PPI::Token::Symbol '%options'
PPI::Token::Operator ','
PPI::Token::Whitespace ' '
PPI::Token::Word 'options'
PPI::Token::Whitespace ' '
PPI::Token::Operator '=>'
PPI::Token::Whitespace ' '
PPI::Token::Number '1'
PPI::Token::Whitespace ' '
PPI::Token::Structure ';'