[Rt-commit] rt branch, 4.0-trunk, updated. rt-4.0.0-421-g0d9f41e
Kevin Falcone
falcone at bestpractical.com
Fri May 20 16:11:51 EDT 2011
The branch, 4.0-trunk has been updated
via 0d9f41ebfe16b2a09a06c366ea8c4aeac78d0515 (commit)
via 212e740e2f1df9845660f454befba1b06df84eb0 (commit)
from 59d03777978213185654e41514744840f3b5ff88 (commit)
Summary of changes:
lib/RT/Shredder/Plugin.pm | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 212e740e2f1df9845660f454befba1b06df84eb0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Mar 3 16:51:05 2011 -0500
Replace 3384147 with a less error-prone explicit loop
An else-less 'if' inside a map produces the single value '' when the
if is false (the return value of the test). In this context, this
would likely lead to an odd number of elements in the hashref, instead
of the pre-3384147 result of simply having a '' key. Additionally,
perlcritic warns (not incorrectly) about the construct.
Replace the map with an explicit for loop, which makes perlcritic
happy, in addition to solving the "odd number of elements" bug above.
(cherry picked from commit 695d1acb59e44938ac9e18bf14a11886cfa03993)
diff --git a/lib/RT/Shredder/Plugin.pm b/lib/RT/Shredder/Plugin.pm
index 79a2a7f..174a5f6 100644
--- a/lib/RT/Shredder/Plugin.pm
+++ b/lib/RT/Shredder/Plugin.pm
@@ -127,7 +127,10 @@ sub List
push @files, glob $mask;
}
- my %res = map { if ( $_ =~ m/([^\\\/]+)\.pm$/) { $1 => $_ } } reverse @files;
+ my %res;
+ for my $f (reverse @files) {
+ $res{$1} = $_ if $f =~ /([^\\\/]+)\.pm$/;
+ }
return %res unless $type;
commit 0d9f41ebfe16b2a09a06c366ea8c4aeac78d0515
Author: Mikal Kolbein Gule <m.k.gule at usit.uio.no>
Date: Wed May 11 11:48:00 2011 -0400
Fix RT::Shredder::Plugin->List to correctly return paths
The refactoring in 695d1ac broke the return value because of the use of
the $f loop variable.
(cherry picked from commit 5add26c8d76d8a25626ba02ebafe0734fb34619f)
diff --git a/lib/RT/Shredder/Plugin.pm b/lib/RT/Shredder/Plugin.pm
index 174a5f6..7974128 100644
--- a/lib/RT/Shredder/Plugin.pm
+++ b/lib/RT/Shredder/Plugin.pm
@@ -129,7 +129,7 @@ sub List
my %res;
for my $f (reverse @files) {
- $res{$1} = $_ if $f =~ /([^\\\/]+)\.pm$/;
+ $res{$1} = $f if $f =~ /([^\\\/]+)\.pm$/;
}
return %res unless $type;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list