🌻 📖 Perl::Critic::Policy::Plicease::ProhibitSignaturesAndAtUnderscore

NAME

Perl::Critic::Policy::Plicease::ProhibitSignaturesAndAtUnderscore - Prohibit the use of @_ in subroutine using signatures

VERSION

version 0.07

SYNOPSIS

 sub foo ($$) { my($a,$b) = @_; }                                    # ok
 use experimental qw( signatures ); foo ($a, $b) { my($c,$d) = @_; } # not ok

DESCRIPTION

When signatures were made non-experimental, @_ used in a subroutine that used signatures was kept as experimental. This is a problem for a few reasons, for one you don't see the experimental warning specific to @_ unless you are running a Perl after signatures were made non-experimental, for another as of Perl 5.39.10 this is still experimental.

AFFILIATION

None.

CONFIGURATION

This policy can be configured to recognize additional modules as enabling the signatures feature, by putting an entry in a .perlcriticrc file like this:

 [Community::Prototypes]
 signature_enablers = Plicease::ProhibitSignaturesAndAtUnderscore

CAVEATS

This module assumes that "prototypes" detected in a source file that has signatures enabled are actually subroutine signatures. This is because through static analysis alone it is not possible to determine if a "prototype" is really a prototype and not a signature. There thus may be false negatives/positives.

AUTHOR

Author: Graham Ollis <plicease@cpan.org>

Contributors:

Ville Skyttä (SCOP)

Yoshikazu Sawa (yoshikazusawa)

COPYRIGHT AND LICENSE

This software is copyright (c) 2019-2024 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.