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

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

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



Subject: Another ProhibitCaptureWithoutTest false positive
I know there are already open bugs against this policy, but here's one more example to consider if and when you get round to fixing it: #!/usr/bin/perl # $Id: $ use warnings; use strict; use Carp qw(croak); our $VERSION = 1; my @a = qw(abc def); foreach (@a) { /(a)/sxm or ( carp('no match'), next ); my $x = $1; print "$x\n" or croak; } There is a test that the regexp matches - and this is reasonably idiomatic, if dense, Perl code. But ProhibitCaptureWithoutTest warns. Perhaps the warning should only fire if static analysis can prove that the capture variable is definitely used later no matter what the result of the regexp match - which would give some false negatives, but eliminate the false positives.