fake_signatures - disallow fake signature optimizations
no fake_signatures;
sub inc_arg { my ($self, $arg) = @_; $arg++ }
This is a new lexical user-pragma since cperl 5.24 to disable the compiler optimization converting normal functions to fake signatures, when the first line in the body is like my ($vars...) = @_;
.
This might be needed if the function is also processed by source filters, e.g. Test::Base with Spiffy.
Use -Dk
with a DEBUGGING perl to see if a subroutine is converted or not, or check via B::Concise.
These cases are automatically converted:
my ($self) = @_;
my ($self, $arg) = @_;
my ($self, $arg, @slurp) = @_;
my @args = @_;
my %args = @_;
These cases are not automatically converted:
my ($self) = shift;
my ($self, $extra) = (@_, 0);
my ($self, @slurp, $arg) = @_;
my ($self, %opts, $arg) = @_;
my $self = shift;
my $arg = shift;