Perl::Critic::PolicyBundle::PERLANCAR::BuiltinFunctions::GrepWithSimpleValue - Warn grep with simple value
This document describes version 0.002 of Perl::Critic::PolicyBundle::PERLANCAR::BuiltinFunctions::GrepWithSimpleValue (from Perl distribution Perl-Critic-PolicyBundle-PERLANCAR), released on 2017-08-16.
This policy is written by HAUKEX.
A grep with a constant value as the last thing in its block will either return all or none of the items in the list (depending on whether the value is true or false). You may have accidentally said grep {123} when you meant grep {$_==123}, or grep {"foo"} when you meant grep {$_ eq "foo"} or grep {/foo/}.
grep
grep {123}
grep {$_==123}
grep {"foo"}
grep {$_ eq "foo"}
grep {/foo/}
Please visit the project's homepage at https://metacpan.org/release/Perl-Critic-PolicyBundle-PERLANCAR.
Source repository is at https://github.com/perlancar/perl-Perl-Critic-PolicyBundle-PERLANCAR.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Critic-PolicyBundle-PERLANCAR
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
http://perlmonks.org/?node_id=1196368
perlancar <perlancar@cpan.org>
This software is copyright (c) 2017 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Perl::Critic::PolicyBundle::PERLANCAR, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perl::Critic::PolicyBundle::PERLANCAR
CPAN shell
perl -MCPAN -e shell install Perl::Critic::PolicyBundle::PERLANCAR
For more information on module installation, please visit the detailed CPAN module installation guide.