Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Perl-Critic CPAN distribution.

Report information
The Basics
Id: 37713
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: kevin [...] nyi.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: RequireArgUnpacking triggered in grep block
Date: Tue, 15 Jul 2008 22:39:59 -0400
To: bug-Perl-Critic [...] rt.cpan.org
From: Kevin Phair <kevin [...] nyi.net>
example: sub example { my %hash = ( a => 1, b => 2, ); my @aoa = ( [ 10, 'a' ], [ 20, 'b' ], [ 30, 'c' ] ); @aoa = grep { $hash{ $$_[1] } } @aoa; return \@aoa; } Using 'little-arrow' dereferencing syntax avoids triggering the unpacked args error.
Subject: Re: [rt.cpan.org #37713] RequireArgUnpacking triggered in grep block
Date: Tue, 15 Jul 2008 21:47:33 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Chris Dolan <chris [...] chrisdolan.net>
Kevin, You've got a valid point -- that really is a false positive -- but, man, the arrow notation is *so* much more readable... I consider myself an expert, but I had to read that example sub several times to figure out what it's doing. Chris On Jul 15, 2008, at 9:41 PM, Kevin Phair via RT wrote: Show quoted text
> Tue Jul 15 22:40:47 2008: Request 37713 was acted upon. > Transaction: Ticket created by kevin@nyi.net > Queue: Perl-Critic > Subject: RequireArgUnpacking triggered in grep block > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: kevin@nyi.net > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=37713 > > > > example: > > sub example { > my %hash = ( > a => 1, > b => 2, > ); > > my @aoa = ( [ 10, 'a' ], [ 20, 'b' ], [ 30, 'c' ] ); > > @aoa = grep { $hash{ $$_[1] } } @aoa; > return \@aoa; > > } > > Using 'little-arrow' dereferencing syntax avoids triggering the > unpacked > args error. >
Subject: Re: [rt.cpan.org #37713] RequireArgUnpacking triggered in grep block
Date: Tue, 15 Jul 2008 23:25:47 -0400
To: bug-Perl-Critic [...] rt.cpan.org
From: Kevin Phair <kevin [...] nyi.net>
Indeed! Since I've never had to mess with that inherited and scary-looking bit of code (the real code managed to be even more confusing than the sample), I've always left it alone. The perlcritic false positive has finally inspired a cleanup effort though, so maybe it should be considered a feature ;p Chris Dolan via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=37713 > > > Kevin, > > You've got a valid point -- that really is a false positive -- but, > man, the arrow notation is *so* much more readable... I consider > myself an expert, but I had to read that example sub several times to > figure out what it's doing. > > Chris > > On Jul 15, 2008, at 9:41 PM, Kevin Phair via RT wrote: >
>> Tue Jul 15 22:40:47 2008: Request 37713 was acted upon. >> Transaction: Ticket created by kevin@nyi.net >> Queue: Perl-Critic >> Subject: RequireArgUnpacking triggered in grep block >> Broken in: (no value) >> Severity: (no value) >> Owner: Nobody >> Requestors: kevin@nyi.net >> Status: new >> Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=37713 > >> >> >> example: >> >> sub example { >> my %hash = ( >> a => 1, >> b => 2, >> ); >> >> my @aoa = ( [ 10, 'a' ], [ 20, 'b' ], [ 30, 'c' ] ); >> >> @aoa = grep { $hash{ $$_[1] } } @aoa; >> return \@aoa; >> >> } >> >> Using 'little-arrow' dereferencing syntax avoids triggering the >> unpacked >> args error. >>
> >
Proposed fix submitted as svn revision 3149. The problem was that the policy was interpreting $$_[] as a use of @_ when it is really an obfuscated equivalent of $_->[]. The fix was to specifically look for '$_' preceded by a '$' cast and followed by a subscript. Tom Wyant
This has been completed and released in Perl-Critic-1.097_002. http://search.cpan.org/~elliotjs/Perl-Critic-1.097_002 Thank you for submitting this ticket.