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

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

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



Subject: ::RequireConstantVersion ($foo = $VERSION) =~ s/// case creates false positive
See the attached test file. C:\>perlcritic --brutal Foo.pm $VERSION value must be a constant at line 7, column 43. Computed $VERSION may tie the code to a single repository, or cause spook y action from a distance. (Severity: 2) The binding op is fooling the detection code.
Subject: Foo.pm
package Foo; use strict; use warnings; our $VERSION = '1.0'; (my $BAR = sprintf q{%s/%s}, __PACKAGE__, $VERSION) =~ s{o\z}{}xms; 1; __END__ =pod =cut
On Mon Mar 15 12:25:38 2010, BURAK wrote: Show quoted text
> See the attached test file. > > C:\>perlcritic --brutal Foo.pm > $VERSION value must be a constant at line 7, column 43. Computed > $VERSION may tie the code to a single repository, or cause spooky > action from a distance. (Severity: 2) > > The binding op is fooling the detection code.
Well, actually the the expression that appears in the title is accepted by this policy; but when $VALUE goes surfing through a subroutine before the result is assigned to the variable the binding op binds to (as it does in the submitted Foo.pm), _that_ throws the policy for a loop. Proposed band-aid submitted as svn revision 3792. I hesitate to call it a complete fix, because I don't feel competent to write a bullet-proof is_this_variable_modified() routine. But with the patch the submitted Foo.pm now passes.