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

Owner: Nobody in particular
Requestors: EDAVIS [...]

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

Subject: Another ProhibitCaptureWithoutTest false positive
Download (untitled) / with headers
text/plain 727b
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.

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

Please report any issues with to