Perl::Critic::Policy::Plicease::ProhibitSignaturesAndAtUnderscore - Prohibit the use of @_ in subroutine using signatures
version 0.10
sub foo ($$) { my($x,$y) = @_; } # ok use experimental qw( signatures ); foo ($x, $y) { 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:
[Plicease::ProhibitSignaturesAndAtUnderscore] signature_enablers = Foo::Bar
For older versions of PPI (newer version is yet unreleased as of this writing), 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. Future versions of this module will require a PPI with better signature detection.
Author: Graham Ollis <plicease@cpan.org>
Contributors:
Ville Skyttä (SCOP)
Yoshikazu Sawa (yoshikazusawa)
Christian Walde (wchristian, MITHALDU)
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.