Subject: | Possible ProtectPrivateSubs False Positive |
This is one of those things that are bugs in the eyes of the beholder.
ProtectPrivateSubs will list this as a violation:
sub {
shift->_foo;
}
while this is fine:
sub {
my $self = shift;
$self->_foo;
}
On on hand...it's clear from looking at the code that shift is the first
@_, and so it's used to call a private sub in the same package. On the
other hand, shift could be returning any of the params in @_ depending
on what has happened in previous to that shift..so it could be calling a
private sub on just about anything.
This is a good policy, but in this case, writing my $self = shift just
to do $self->_foo is more code than necessary.