Perl5-IDEA
Perl5-IDEA copied to clipboard
Make call parameters mutation inspection
Mutating elements of @_ causes mutating of passed parameters and fails if passed parameter is RO. Inspection should show such problems.
Example illustrating the issue:
use strict;
use warnings FATAL => 'all';
use v5.10;
package Foo::Bar;
sub new {
bless {}, 'Foo::Bar';
}
sub foo {
# First way
$_[0] = -1;
# Second way
@_[1] = (-2);
# Third way
my $argref = \@_;
$argref->[2] = -3;
# Forth way
$argref = \$_[3];
$$argref = -4;
}
package main;
my $obj = Foo::Bar->new();
my @args = (1,2,3);
say join ', ', $obj, @args;
$obj->foo(@args);
say join ', ', $obj, @args;