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

People
Owner: Nobody in particular
Requestors: perl [...] galumph.com
Cc:
AdminCc:

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



CC: eldar [...] trellian.com
Subject: RequireArgUnpacking: handle POE parameter passing standard
Date: Wed, 12 Mar 2008 01:33:52 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
It seems that perlcritic will return "Always unpack @_ first" complaints for code, usch as: my ( $kernel, $heap, $input ) = @_[ KERNEL, HEAP, ARG0 ]; As most of my work is done in POE I find this far more convenient and http://perlcritic.com/pod/Perl/Critic/Policy/Subroutines/RequireArgUnpacking.html does not indicate that such invocation is clearly good or bad practise. Could you please update your documentation (and rules?) to accomodate this? Regards, Eldar Marcussen
Subject: Re: [rt.cpan.org #34009] RequireArgUnpacking: handle POE parameter passing standard
Date: Wed, 12 Mar 2008 01:38:40 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Eldar Marcussen wrote: Show quoted text
> It seems that perlcritic will return "Always unpack @_ first" complaints > for code, usch as: > my ( $kernel, $heap, $input ) = @_[ KERNEL, HEAP, ARG0 ];
What exactly are KERNEL, HEAP, and ARG0? File handles? Subroutines, whether created yourself (or POE code) or by "use constant"? Not sure how this should be parsed.
Subject: Re: [rt.cpan.org #34009] RequireArgUnpacking: handle POE parameter passing standard
Date: Wed, 12 Mar 2008 01:41:46 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Elliot Shank via RT wrote: Show quoted text
> Eldar Marcussen wrote:
>> It seems that perlcritic will return "Always unpack @_ first" complaints >> for code, usch as: >> my ( $kernel, $heap, $input ) = @_[ KERNEL, HEAP, ARG0 ];
> > What exactly are KERNEL, HEAP, and ARG0? > > File handles? > Subroutines, whether created yourself (or POE code) or by "use constant"? > > Not sure how this should be parsed.
Good question, you should probably ask some of the POE guys, or in #perl. Afaik they are object references to the POE::Kernel singleton ( http://poe.perl.org/?Evolution_of_a_POE_Server ). Regards, Eldar Marcussen
Subject: Re: [rt.cpan.org #34009] RequireArgUnpacking: handle POE parameter passing standard
Date: Wed, 12 Mar 2008 01:49:40 -0500
To: bug-Perl-Critic [...] rt.cpan.org
From: Elliot Shank <perl [...] galumph.com>
Now that I've replicated the email exchange in RT... It looks like these values are defined in http://search.cpan.org/src/RCAPUTO/POE-0.9999/lib/POE/Session.pm as ye olde zero argument, constant value subroutines, so they get inlined. Still not sure how to address this. (actually, it's probably going to be reasonably easy, once one of us developers gets around to looking at the policy code.) #------------------------------------------------------------------------------ # Export constants into calling packages. This is evil; perhaps # EXPORT_OK instead? The parameters NFA has in common with SESSION # (and other sessions) must be kept at the same offsets as each-other. sub OBJECT () { 0 } sub SESSION () { 1 } sub KERNEL () { 2 } sub HEAP () { 3 } sub STATE () { 4 } sub SENDER () { 5 } # NFA keeps its state in 6. unused in session so that args match up. sub CALLER_FILE () { 7 } sub CALLER_LINE () { 8 } sub CALLER_STATE () { 9 } sub ARG0 () { 10 } sub ARG1 () { 11 } sub ARG2 () { 12 } sub ARG3 () { 13 } sub ARG4 () { 14 } sub ARG5 () { 15 } sub ARG6 () { 16 } sub ARG7 () { 17 } sub ARG8 () { 18 } sub ARG9 () { 19 } sub import { my $package = caller(); no strict 'refs'; *{ $package . '::OBJECT' } = \&OBJECT; *{ $package . '::SESSION' } = \&SESSION; *{ $package . '::KERNEL' } = \&KERNEL; *{ $package . '::HEAP' } = \&HEAP; *{ $package . '::STATE' } = \&STATE; *{ $package . '::SENDER' } = \&SENDER; *{ $package . '::ARG0' } = \&ARG0; *{ $package . '::ARG1' } = \&ARG1; *{ $package . '::ARG2' } = \&ARG2; *{ $package . '::ARG3' } = \&ARG3; *{ $package . '::ARG4' } = \&ARG4; *{ $package . '::ARG5' } = \&ARG5; *{ $package . '::ARG6' } = \&ARG6; *{ $package . '::ARG7' } = \&ARG7; *{ $package . '::ARG8' } = \&ARG8; *{ $package . '::ARG9' } = \&ARG9; *{ $package . '::CALLER_FILE' } = \&CALLER_FILE; *{ $package . '::CALLER_LINE' } = \&CALLER_LINE; *{ $package . '::CALLER_STATE' } = \&CALLER_STATE; }
From: MARCUSSEN [...] cpan.org
The same seems to apply in scalar more (yes, it's not shift) so according to PBP page 179 or there abouts, this might be correct behavior; sub server_start { my $heap = $_[HEAP]; Regards, Eldar Marcussen
A proposed fix to the array slice portion of the request is submitted as svn revision 3105. Tom Wyant
Implement the scalar portion of the request as svn revision 3106. Tie both this and the array slice portion (svn revision 3105) to new Boolean configuration option 'allow_subscripts', whose default is false. I believe these two changes implement between them the requested change. 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.