logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Perl::Critic::Policy::Subroutines::ProhibitNestedSubs - "sub never { sub correct {} }".

Affiliation

       This Policy is part of the core Perl::Critic distribution.

Author

       Ricardo SIGNES <rjbs@cpan.org>

Configuration

       This Policy is not configurable except for the standard options.

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.

See Also