Perl::...kNames(3pm)
hey bestie π this is Perl::...kNames(3pm) from the User Contributed Perl Documentation, and itβs here to save you from a truly iconic typo.
π NAME π
Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames β donβt use labels that are the same as the special block names. periodt.
π«Ά AFFILIATION π«Ά
This Policy is part of the core Perl::Critic distribution. no cap.
β¨ DESCRIPTION β¨
okay so when youβre using one of the special Perl blocks β BEGIN, END, CHECK, INIT, and UNITCHECK β it is easy to mistakenly add a colon to the end of the block name. literally so easy. E.g.:
# a BEGIN block that gets executed at compile time.
BEGIN { <...code...> }
# an ordinary labeled block that gets executed at run time.
BEGIN: { <...code...> }
The labels BEGIN:, END:, etc. are probably errors. π¨ This policy prohibits the special Perl block names from being used as labels. periodt.
π CONFIGURATION π
This Policy is not configurable except for the standard options. thatβs it, bestie π .
π SEE ALSO π
The Perl Buzz article on this issue at http://perlbuzz.com/2008/05/colons-invalidate-your-begin-and-end-blocks.html. iykyk.
π ACKNOWLEDGMENT π
Randy Lauen for identifying the problem. π«Ά
π AUTHOR π
Mike OβRegan. π
π¦ COPYRIGHT π¦
Copyright (c) 2008-2011 Mike OβRegan. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
later bestie, and remember: this page is perl v5.42.0, dated 2024-10-23, and its manual name is Perl::...kNames(3pm). πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Perl-Critic 1.156.0-bp160.1.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms