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

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

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



Subject: P::C::Policy::RegularExpressions::ProhibitCaptureWithoutTest does not recognize the trinary conditional as a test...
This may not be a "bug" per say, but this code passes the spirit of the check, if not the letter of what it's currently checking... Maybe it should check for the regexp capture variables being in the ? portion of the "trinary conditional" (not the : part), as well.
Subject: code.pl
my $addr = ($smtp_server =~ m{ # Match \A # ... start of the string, (\d{1,3}) # ... then 1-3 digits, \.(\d{1,3}) # ... then a dot and 1-3 digits \.(\d{1,3}) # ... then do it again \.(\d{1,3}) # ... then do it yet again \z # ... then match the end of the string. }xms) ? pack('C4', $1, $2, $3, $4) ##no critic (ProhibitCaptureWithoutTest) : (gethostbyname($smtp_server)) ;
From: admwiggin [...] gmail.com
As far as I can tell, this bug is fixed in the most recent release (working in my codebase, anyhow).
I just hit this, with v1.118, on this code: my $proxy_port = ($proxy =~ s/:(\d+)//) ? $1 : 8888; Capture variable used outside conditional (See page 253 of PBP)