Login
Variables::ProhibitReusedVarNames bug fix (PPI returns '' instead of undef for false...)
authorChris Dolan <chris+github@chrisdolan.net>
Sun, 28 Sep 2008 05:55:46 +0000 (05:55 +0000)
committerChris Dolan <chris+github@chrisdolan.net>
Sun, 28 Sep 2008 05:55:46 +0000 (05:55 +0000)
lib/Perl/Critic/Policy/Variables/ProhibitReusedVarNames.pm
t/03_pragmas.t

index 557a2bd..4c80316 100644 (file)
@@ -47,10 +47,10 @@ sub violates {
     my @violations;
     while (1) {
        my $up = $outer->sprevious_sibling;
-       if (! defined $up) {
+       if (!$up) {
           $up = $outer->parent;
        }
-       last if ! defined $up; # top of PDOM, we're done
+       last if !$up; # top of PDOM, we're done
        $outer = $up;
 
        if ($outer->isa('PPI::Statement::Variable') && 'local' ne $outer->type) {
index 81f24e2..fe5c70f 100644 (file)
@@ -34,6 +34,7 @@ my $profile = {
     '-Miscellanea::ProhibitUnrestrictedNoCritic'                 => {},
     '-Miscellanea::RequireRcsKeywords'                           => {},
     '-ValuesAndExpressions::ProhibitMagicNumbers'                => {},
+    '-Variables::ProhibitReusedVarNames'                         => {},
 };
 
 my $code = undef;