Perl::Critic::Policy::Subroutines::ProhibitNestedSubs - "sub never { sub correct {} }".
Contents
Affiliation
This Policy is part of the core Perl::Critic distribution.
Configuration
This Policy is not configurable except for the standard options.
Copyright
Copyright (c) 2007-2011 Ricardo SIGNES.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl
itself.
perl v5.40.0 2024-10-28 Perl::Critic::...hibitNestedSubs(3pm)
Description
Attentionwould-becleverPerlwriters(includingYoungerRJBS):
This does not do what you think:
sub do_something {
...
sub do_subprocess {
...
}
...
}
do_subprocess() is global, despite where it is declared. Either write your subs without nesting or use
anonymous code references.
Name
Perl::Critic::Policy::Subroutines::ProhibitNestedSubs - "sub never { sub correct {} }".
Note
Originally part of Perl::Critic::Tics.
