[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-27-g78d74e4

Alex Vandiver alexmv at bestpractical.com
Wed Jun 29 17:45:10 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  78d74e4e75a09dced2f0e86a7c17cb9d886b34ed (commit)
      from  17523fc47ff32fe071f5e0a615fa8ab2ec682974 (commit)

Summary of changes:
 bin/rt.in                       |   23 +++++++++++------------
 share/html/User/Delegation.html |    6 +++---
 2 files changed, 14 insertions(+), 15 deletions(-)

- Log -----------------------------------------------------------------
commit 78d74e4e75a09dced2f0e86a7c17cb9d886b34ed
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 17:32:59 2011 -0400

    Ensure that all loop variables are properly localized

diff --git a/bin/rt.in b/bin/rt.in
index e33253b..c0ef3ad 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -213,10 +213,10 @@ sub help {
     if (!%help) {
         local $/ = undef;
         foreach my $item (@{ Form::parse(<DATA>) }) {
-            my $title = $item->[2]{Title};
-            my @titles = ref $title eq 'ARRAY' ? @$title : $title;
+            my $titleref = $item->[2]{Title};
+            my @titles = ref $titleref eq 'ARRAY' ? @$titleref : $titleref;
 
-            foreach $title (grep $_, @titles) {
+            foreach my $title (grep $_, @titles) {
                 $help{$title} = $item->[2]{Text};
             }
         }
@@ -588,7 +588,6 @@ sub edit {
 
             foreach my $form (@$forms) {
                 my ($c, $o, $k, $e) = @$form;
-                my ($key, $val);
 
                 next if ($e || !@$o);
 
@@ -597,14 +596,14 @@ sub edit {
                 local %set = %set;
 
                 # Make changes to existing fields.
-                foreach $key (@$o) {
+                foreach my $key (@$o) {
                     if (exists $add{lc $key}) {
-                        $val = delete $add{lc $key};
+                        my $val = delete $add{lc $key};
                         vpush($k, $key, $val);
                         $k->{$key} = vsplit($k->{$key}) if $val =~ /[,\n]/;
                     }
                     if (exists $del{lc $key}) {
-                        $val = delete $del{lc $key};
+                        my $val = delete $del{lc $key};
                         my %val = map {$_=>1} @{ vsplit($val) };
                         $k->{$key} = vsplit($k->{$key});
                         @{$k->{$key}} = grep {!exists $val{$_}} @{$k->{$key}};
@@ -615,8 +614,8 @@ sub edit {
                 }
                 
                 # Then update the others.
-                foreach $key (keys %set) { vpush($k, $key, $set{$key}) }
-                foreach $key (keys %add) {
+                foreach my $key (keys %set) { vpush($k, $key, $set{$key}) }
+                foreach my $key (keys %add) {
                     vpush($k, $key, $add{$key});
                     $k->{$key} = vsplit($k->{$key});
                 }
@@ -1321,13 +1320,13 @@ sub Form::compose {
 
             foreach my $key (@$o) {
                 my ($line, $sp);
-                my $v = $k->{$key};
-                my @values = ref $v eq 'ARRAY' ? @$v : $v;
+                my $vref = $k->{$key};
+                my @values = ref $vref eq 'ARRAY' ? @$vref : $vref;
 
                 $sp = " "x(length("$key: "));
                 $sp = " "x4 if length($sp) > 16;
 
-                foreach $v (@values) {
+                foreach my $v (@values) {
                     if ($v =~ /\n/) {
                         $v =~ s/^/$sp/gm;
                         $v =~ s/^$sp//;
diff --git a/share/html/User/Delegation.html b/share/html/User/Delegation.html
index bae3393..3358935 100755
--- a/share/html/User/Delegation.html
+++ b/share/html/User/Delegation.html
@@ -61,8 +61,8 @@
 </form>
 <%INIT>
 
-my (@results, $arg);
-foreach $arg (keys %ARGS) {
+my (@results);
+foreach my $arg (keys %ARGS) {
     next unless ($arg =~ /^Delegate-Existing-ACE-(\d+)-to-(\d+)-as-(\d+)$/);
        my $parent = $1;
        my $principal = $2;
@@ -75,7 +75,7 @@ foreach $arg (keys %ARGS) {
        }
 }
 
-foreach $arg (keys %ARGS) { 
+foreach my $arg (keys %ARGS) {
     next unless ($arg =~ /^Delegate-ACE-(\d+)-to-(\d+)$/);
     my $parent = $1;
     my $principal = $2;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list