NAME
Perl::Critic::PolicyBundle::LoopsAndLabels - Bundle of policies for loop control flow and labels
VERSION
version 0.07
DESCRIPTION
This is a bundle of Perl::Critic policies related to loop control flow and labeling. Install this bundle to get all three policies at once.
The policies in this bundle complement each other:
- Perl::Critic::Policy::ControlStructures::LoopsRequireLabels
-
Requires that loops containing
next,last, orredocarry explicit labels, and that those break keywords reference a label. Configurable viamode(always,nested,max_lines). - Perl::Critic::Policy::ControlStructures::ProhibitBareBlockLoopControls
-
Flags
next,last, andredoinside non-loop blocks: bare{}blocks,do {},eval {}, anonymous subroutines, andmap/grep. Configurable per-keyword (forbid,require_label,allow) and per-block-type (do_block,bare_block). - Perl::Critic::Policy::ControlStructures::ProhibitGotoIntoConstruct
-
Flags
goto LABELwhen the target label is inside a loop or block construct. This pattern is deprecated in Perl and will become a fatal error in Perl 5.44 (see perldeprecation).
NAME
Perl::Critic::PolicyBundle::LoopsAndLabels - Bundle of policies for loop control flow and labels
INCLUDED POLICIES
- Perl::Critic::Policy::ControlStructures::LoopsRequireLabels
-
Default severity: 3 (high). Default theme:
control. - Perl::Critic::Policy::ControlStructures::ProhibitBareBlockLoopControls
-
Default severity: 1 (highest). Default themes:
bugs,control. - Perl::Critic::Policy::ControlStructures::ProhibitGotoIntoConstruct
-
Default severity: 3 (high). Default theme:
control.
AFFILIATION
This bundle is the distribution root for all three included policies.
CONFIGURATION AND ENVIRONMENT
All policies included are in the control theme. See the Perl::Critic documentation for how to configure each policy individually.
Example perlcriticrc:
# Enable all policies from this bundle
[ControlStructures::LoopsRequireLabels]
mode = nested
[ControlStructures::ProhibitBareBlockLoopControls]
next = forbid
last = require_label
redo = forbid
[ControlStructures::ProhibitGotoIntoConstruct]
SEE ALSO
Perl::Critic, "next" in perlfunc, "last" in perlfunc, "redo" in perlfunc, "goto" in perlfunc, perldeprecation
AUTHOR
Dean Hamstead <dean@fragfest.com.au>
COPYRIGHT
Copyright (c) 2026 Dean Hamstad. All rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Dean Hamstead <dean@fragfest.com.au>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2026 by Dean Hamstead.
This is free software, licensed under:
The MIT (X11) License