Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 75920
Status: open
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: EDAVIS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.117
Fixed in: (no value)



Subject: ProhibitInterpolationOfLiterals false positive with map and regexp match
map { 0 } /"/ gives a false positive Useless interpolation of literal string at line 1, column 12. See page 51 of PBP. (Severity: 1)
Subject: Various false positives with map and regexp match
This also gives a false positive from ValuesAndExpressions::ProhibitMismatchedOperators: Mismatched operator at line 1, column 11. Numeric/string operators and operands should match. (Severity: 3)
Looks like a PPI bug: % cat test map { 0 } /"/ % perl -MPPI -MPPI::Dumper -E 'my $p = new PPI::Document "test"; my $d = new PPI::Dumper $p; $d->print' PPI::Document PPI::Statement PPI::Token::Word 'map' PPI::Token::Whitespace ' ' PPI::Structure::Block { ... } PPI::Token::Whitespace ' ' PPI::Statement PPI::Token::Number '0' PPI::Token::Whitespace ' ' PPI::Token::Whitespace ' ' PPI::Token::Operator '/' PPI::Token::Quote::Double '"/\n'
Just to show that PPI is wrong, and it really is a regexp match not a division: % cat test use 5.010; $_ = '"""'; @a = map { 0 } /"/g; say "@a"; % perl test 0 0 0 % perl -MPPI -MPPI::Dumper -E 'my $p = new PPI::Document "test"; my $d = new PPI::Dumper $p; $d->print' PPI::Document PPI::Statement::Include PPI::Token::Word 'use' PPI::Token::Whitespace ' ' PPI::Token::Number::Float '5.010' PPI::Token::Structure ';' PPI::Token::Whitespace '\n' PPI::Statement PPI::Token::Magic '$_' PPI::Token::Whitespace ' ' PPI::Token::Operator '=' PPI::Token::Whitespace ' ' PPI::Token::Quote::Single ''"""'' PPI::Token::Structure ';' PPI::Token::Whitespace '\n' PPI::Statement PPI::Token::Symbol '@a' PPI::Token::Whitespace ' ' PPI::Token::Operator '=' PPI::Token::Whitespace ' ' PPI::Token::Word 'map' PPI::Token::Whitespace ' ' PPI::Structure::Block { ... } PPI::Token::Whitespace ' ' PPI::Statement PPI::Token::Number '0' PPI::Token::Whitespace ' ' PPI::Token::Whitespace ' ' PPI::Token::Operator '/' PPI::Token::Quote::Double '"/g;\nsay "' PPI::Token::Symbol '@a' PPI::Token::Quote::Double '";\n'
Filed against PPI as #75921.