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:
69865
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
Mark.Martinec [...] ijs.si
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: RegularExpressions::ProhibitCaptureWithoutTest prohibits local($1,$2,$3)
Date: Thu, 28 Jul 2011 18:34:32 +0200
To: bug-Perl-Critic@rt.cpan.org
From: Mark Martinec <Mark.Martinec@ijs.si>
FreeBSD 8.2, perl 5.14.1, Perl::Critic 1.116 As best practices the $1, $2, $3, ... globals are commonly localized within inner routines. One reason for this is to avoid a perl #67962 taint bug, the other is to protect a caller from unexpected side effects of the called code. The RegularExpressions::ProhibitCaptureWithoutTest test unwarrantly claims that local($1,$2,$3) is a case of a 'Capture variable used outside conditional': $ perlcritic -3 use strict; use warnings; # false positive: RegularExpressions::ProhibitCaptureWithoutTest local($1,$2,$3); # workaround for a perl bug #67962, best practices if (/(.)(.)(.)/x) { my($a1,$a2,$a3) = ($1,$2,$3); # ... } Capture variable used outside conditional at line 5, column 9. See page 253 of PBP. (Severity: 3) Capture variable used outside conditional at line 5, column 12. See page 253 of PBP. (Severity: 3) Capture variable used outside conditional at line 5, column 15. See page 253 of PBP. (Severity: 3) Mark


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

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