The Perl Advent Calendar needs more articles for 2022. Submit your idea today!

Search results for "module:Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval"

Perl::Critic::Policy::BuiltinFunctions::ProhibitStringyEval - Write eval { my $foo; bar($foo) } instead of eval "my $foo; bar($foo);". River stage three • 131 direct dependents • 386 total dependents

The string form of "eval" is recompiled every time it is executed, whereas the block form is only compiled once. Also, the string form doesn't give compile-time warnings. eval "print $foo"; # not ok eval {print $foo}; # ok...

PETDANCE/Perl-Critic-1.140 - 24 Mar 2021 03:09:35 UTC

Perl::Critic::Policy::Lax::ProhibitStringyEval::ExceptForRequire - stringy eval is bad, but it's okay just to "require" River stage two • 6 direct dependents • 12 total dependents

Sure, everybody sane agrees that stringy "eval" is usually a bad thing, but sometimes you need it, and you don't want to have to stick a "no critic" on the end, because dangit, what you are doing is *just not wrong*! See, "require" is busted. You can...

RJBS/Perl-Critic-Lax-0.013 - 13 Mar 2017 12:34:51 UTC

Perl::Critic::Policy::BuiltinFunctions::RequireBlockMap - Write map { /$pattern/ } @list instead of map /$pattern/, @list. River stage three • 131 direct dependents • 386 total dependents

The expression forms of "grep" and "map" are awkward and hard to read. Use the block forms instead. @matches = grep /pattern/, @list; #not ok @matches = grep { /pattern/ } @list; #ok @mapped = map transform($_), @list; #not ok @mapped = map { transfo...

PETDANCE/Perl-Critic-1.140 - 24 Mar 2021 03:09:35 UTC

Perl::Critic::Policy::BuiltinFunctions::RequireBlockGrep - Write grep { /$pattern/ } @list instead of grep /$pattern/, @list. River stage three • 131 direct dependents • 386 total dependents

The expression forms of "grep" and "map" are awkward and hard to read. Use the block forms instead. @matches = grep /pattern/, @list; #not ok @matches = grep { /pattern/ } @list; #ok @mapped = map transform($_), @list; #not ok @mapped = map { transfo...

PETDANCE/Perl-Critic-1.140 - 24 Mar 2021 03:09:35 UTC
4 results (0.066 seconds)