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

People
Owner: Nobody in particular
Requestors: jmlilly [...] us.ibm.com
Cc:
AdminCc:

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



Subject: Subroutines::RequireArgUnpacking allow_delegation_to does not handle @_ plus additional args
Date: Fri, 24 Aug 2012 13:14:20 -0400
To: bug-Perl-Critic [...] rt.cpan.org
From: Jess M Lilly <jmlilly [...] us.ibm.com>
Download (untitled) / with headers
text/plain 618b
Hi, I have my perl critic config file set up with this: [Subroutines::RequireArgUnpacking] allow_delegation_to = dpStandards:: scalar short_subroutine_statements = 5 The call to scalar works fine. In other words, scalar(@_) is allowed and there is no violation. But, calls a call like this gets a violation when it should not: dpStandards::validateArgs( @_, 1 ); If I remove the ,1 then the violation goes away. dpStandards::validateArgs( @_ ); Please fix RequireArgUnpacking to acount for more than one parameter in the allow_delegation_to config. Thanks you for working on Critic. It is an AWESOME tool.
Download (untitled) / with headers
text/plain 1.5k
On Fri Aug 24 13:13:58 2012, jmlilly@us.ibm.com wrote: Show quoted text
> > Hi, > > I have my perl critic config file set up with this: > > [Subroutines::RequireArgUnpacking] > allow_delegation_to = dpStandards:: scalar > short_subroutine_statements = 5 > > The call to scalar works fine. In other words, scalar(@_) is allowed and > there is no violation. > > But, calls a call like this gets a violation when it should not: > > dpStandards::validateArgs( @_, 1 ); > > If I remove the ,1 then the violation goes away. > > dpStandards::validateArgs( @_ ); > > Please fix RequireArgUnpacking to acount for more than one parameter
in the Show quoted text
> allow_delegation_to config. > > Thanks you for working on Critic. It is an AWESOME tool.
Hmm... Actually, as documented the policy forbids arguments in addition to @_. See the paragraph just above the CONFIGURATION section in the POD for this policy. As its name implies, allow_delegation_to was added to allow delegation of functionality over and above the hard-coded $object->SUPER::something( @_ ) and $object->NEXT::something( @_ ), and in response to https://rt.cpan.org/Ticket/Display.html?id=33839 In the discussion on that ticket, it was decided to disallow arguments over and above the @_, since that was all that was allowed in the code that was being extended. That said, Perl::Critic has no knowledge of the semantics of the subroutine, only the syntax, and so "off-label" uses like argument list validaters and unpackers get shoved into allow_delegation_to. So I'm going to mark this as a wishlist item, and solicit discussion from other developers. Elliot? Jeff?
Subject: re: [rt.cpan.org #79200] Subroutines::RequireArgUnpacking allow_delegation_to
Date: Sun, 24 Feb 2013 15:12:26 -0000
To: <bug-Perl-Critic [...] rt.cpan.org>
From: "Duncan Garland" <duncan.garland [...] ntlworld.com>
Download (untitled) / with headers
text/plain 614b
Hi, Has there been any further progress on this? We use Params::Validate quite a lot and I believe it is quite a poular CPAN module. The basic construct for use in a function is sub whatever { my ( $x, $y ) = validate_pos( @_, 1, 1 ) etc } Or sub whatever { my ( %p ) = validate( @_, { x => 1, y => 1 } ); etc } And for methods sub whatever { my ( $self, $x, $y ) = validate_pos( @_, 1, 1, 1 ) etc } sub whatever { my $self = shift(@_); my ( %p ) = validate( @_, { x => 1, y => 1 } ); etc } I've had RequireArgUnpacking disabled, but I'd like to enable it. Regards Duncan


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.