The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

VERSION

version 0.06

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)

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.