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

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

Bug Information
Severity: Normal
Broken in: 1.105
Fixed in: 1.108



Subject: Too many arguments (sub prototype; false positive)
Too many arguments at line 4, column 1. See page 182 of PBP. 1 #!/usr/bin/perl 2 use strict; 3 4 sub test ( $ ; $ ) 5 { 6 1; 7 } the prototype definition is valid.
On Thu Apr 15 07:24:42 2010, JARIAALTO wrote: Show quoted text
> Too many arguments at line 4, column 1. See page 182 of PBP. > > 1 #!/usr/bin/perl > 2 use strict; > 3 > 4 sub test ( $ ; $ ) > 5 { > 6 1; > 7 } > > the prototype definition is valid.
This looks like a real Perl::Critic bug to me. The question is not whether the prototype is valid, it is how many arguments it specifies. The right answer is 2, but the code was computing the number of arguments as the length of the prototype string minus 2 for the parentheses. This is wrong not only because of embedded spaces, but because of the semicolon, possible back slashes and square brackets, and so on (see perlsub). Proposed fix committed as revision 3798. I even remembered to update Changes (and there was great rejoicing.)