Perl::Critic::Policy::Plicease::ProhibitSignaturesAndAtUnderscore - Prohibit the use of @_ in subroutine using signatures
version 0.07
sub foo ($$) { my($a,$b) = @_; } # ok use experimental qw( signatures ); foo ($a, $b) { my($c,$d) = @_; } # not ok
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.
None.
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
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: Graham Ollis <plicease@cpan.org>
Contributors:
Ville Skyttä (SCOP)
Yoshikazu Sawa (yoshikazusawa)
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.