On Tue Feb 01 02:51:35 2011, ANDK wrote:
Show quoted text> As per subject.
>
> CC'd to Adam. I don't know whether PPI or P:C need fixing.
>
> Both Perl-Critic 1.111 and 1.112_001 are affected in t/20_policies.t
>
> # Failed test 'Subroutines::RequireArgUnpacking - line 233 - but catch
> @$_[0] outside of a postfix for loop'
> # at t/20_policies.t line 27.
> # Expected 1 violations, got 0.
> # Looks like you failed 1 test of 2642.
>
> HTH, Cheers,
Thank you for the report.
My read on this is that it is a bad test exposed by a change in PPI. But
I was involved in the PPI change, so I would appreciate other eyes on
the test, since if I'm wrong I committed a bad change to PPI.
The test appears to assume that @$_[0] makes use of @_. But when I try
it it appears to make use of $_. At least, when I execute
sub my_sub {
my @a = ( [ 1, 2 ], [ 3, 4 ] );
for (@a){
print @$_[0], "\n";
}
print @$_[0], "\n";
}
$_ = [ qw{ uno dos tres cuatro } ];
my_sub([ 'I', 'II' ], [ 'III', 'IV' ]);
which is a gussied up version of the failing test, it prints
13
uno
rather than
13
IIII
as I might expect if @$_[0] accessed @_.
The PPI connection is
https://rt.cpan.org/Ticket/Display.html?id=65199
which patches the PPI::Token::Symbol->symbol() method. This ticket
addresses the fact that $$a[0] is actually $a->[0], not ${$a[0]}, and
therefore symbol() should return '$a', not '@a' as it was formerly
doing. The SVN commit also addressed the case of @$a[0] as being '$a',
per the above analysis, though I was silent about that in the RT ticket.
Bottom line: if my analysis is right, this is a bad test. If I'm wrong,
I need to fix my PPI change.
Tom