Grinnz / Perl-Critic-Community

Perl::Critic::Community - Community-inspired Perl::Critic policies
https://metacpan.org/pod/Perl::Critic::Community
Other
8 stars 10 forks source link

Perl::Critic::Policy::Freenode::DeprecatedFeatures doesn't understand postfix deref #26

Closed simcop2387 closed 7 years ago

simcop2387 commented 7 years ago

The following snippet results in a perlcritic issue

use strict;
use warnings;

my $foo = {workers => {a => b => c =>4}};

if (keys $foo->workers->%* < 4) {
  print "Warnings";
}

autoderef is deprecated at line 6, column 5. Use of each/keys/pop/push/shift/splice/unshift/values on a reference is an experimental feature that is removed in perl v5.24.0. Dereference the array or hash to use these functions on it. (Severity: 4)

Grinnz commented 7 years ago

Thanks. I'll take a stab at recognizing this case but I'm not sure if PPI recognizes this syntax yet either.

Grinnz commented 7 years ago

Actually I am already checking for this case but my hack got fooled by the < 4 at the end.

Grinnz commented 7 years ago

Fixed in 0.021