NAME
Perl::Critic::Policy::ControlStructures::ProhibitInlineDo - Use subroutines instead of inline do-blocks.
DESCRIPTION
Functions permit code reuse, isolate scope, and reduce complexity.
my $handler //= do { ... }; # no
my $handler //= build_handler(...); # ok
my $value = 1 + do {...} + do {...}; # no
my $value = 1 + f(...) + g(...); # ok
Standalone do-blocks are not considered violations.
do { $x++ } foreach (...); # ok
CONFIGURATION
None.
NOTES
Custom subroutines called do
will be considered a violation if they are called as do {...}
.
Right-hand evaluation of regular expressions is not checked. EG $x=~s/./do{-}/e