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: 57639
Status: resolved
Priority: 0/
Queue: Perl-Critic

People
Owner: Nobody in particular
Requestors: dolmen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 1.097_002



Subject: Subroutines::RequireArgUnpacking should detect more forms of unpacking (POE style)
The common idiom for POE programming is: use POE; sub my_event { my ($k, $s, $arg0) = @_[KERNEL, SESSION, ARG0]; ... } Subroutines::RequireArgUnpacking should detect this style as correct @_ unpacking. -- Olivier Mengué - http://o.mengue.free.fr/
Subject: Re: [rt.cpan.org #57639] Subroutines::RequireArgUnpacking should detect more forms of unpacking (POE style)
Date: Wed, 19 May 2010 19:21:06 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
On 5/19/10 12:49 PM, Olivier 'dolmen' Mengué via RT wrote: Show quoted text
> The common idiom for POE programming is: > > use POE; > sub my_event > { > my ($k, $s, $arg0) = @_[KERNEL, SESSION, ARG0]; > > ... > } > > Subroutines::RequireArgUnpacking should detect this style as correct @_ > unpacking.
What version of Perl::Critic are you using? This is a duplicate of https://rt.cpan.org/Public/Bug/Display.html?id=34009 which was supposedly fixed.
On Wed May 19 20:21:15 2010, clonezone wrote: Show quoted text
> On 5/19/10 12:49 PM, Olivier 'dolmen' Mengué via RT wrote:
> > The common idiom for POE programming is: > > > > use POE; > > sub my_event > > { > > my ($k, $s, $arg0) = @_[KERNEL, SESSION, ARG0]; > > > > ... > > } > > > > Subroutines::RequireArgUnpacking should detect this style as correct
> @_
> > unpacking.
> > What version of Perl::Critic are you using? This is a duplicate of > https://rt.cpan.org/Public/Bug/Display.html?id=34009 which was > supposedly fixed.
The docs for Perl::Critic::Policy::Subroutines::RequireArgUnpacking say By default this policy does not allow you to specify array subscripts when you unpack arguments (i.e. by an array slice or by referencing individual elements). Should you wish to permit this, you can do so using the "allow_subscripts" setting. This defaults to false. You can set it true like this: [Subroutines::RequireArgUnpacking] allow_subscripts = 1 Did you in fact do this in your .perlcriticrc file? Alternatively, did you use @_ anywhere else in the subroutine? This policy does not simply look for an unpacking it understands -- it looks for _all_ uses of @_, and complains if it sees any it does not like. I have been bitten by this a couple times when making my code Perl::Critic compliant.