Perl-Critic/PPI

CHECK bareword handle parsed as scheduled statement

Opened this issue · 1 comments

From Grinnz/Perl-Critic-Community#33:

> cat minimal
#!/usr/bin/perl

open(CHECK, '/foo');

> ppi_dumper minimal 
PPI::Document
  PPI::Token::Comment   '#!/usr/bin/perl\n'
  PPI::Token::Whitespace        '\n'
  PPI::Statement
    PPI::Token::Word    'open'
    PPI::Structure::List        ( ... )
      PPI::Statement::Scheduled
        PPI::Token::Word        'CHECK'
        PPI::Token::Operator    ','
        PPI::Token::Whitespace          ' '
        PPI::Token::Quote::Single       ''/foo''
    PPI::Token::Structure       ';'
  PPI::Token::Whitespace        '\n'

It should not be possible for statements to start in this structure - I can confirm it also happens for other scheduled statement keywords like BEGIN and INIT.

Pull request just made. Not sure I held my tongue right to connect it to this issue. Sorry.