[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.4-557-g076b60e

Shawn Moore sartak at bestpractical.com
Tue Nov 23 12:29:02 EST 2010


The branch, 3.9-trunk has been updated
       via  076b60e18f75196b2003e91b170c761342f67cce (commit)
      from  b571cb5d62746601e967b9ffd78cde85e1ba339c (commit)

Summary of changes:
 lib/RT/EmailParser.pm |   13 +++----------
 t/api/emailparser.t   |    2 +-
 2 files changed, 4 insertions(+), 11 deletions(-)

- Log -----------------------------------------------------------------
commit 076b60e18f75196b2003e91b170c761342f67cce
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Tue Nov 23 12:28:46 2010 -0500

    Clean up CullRTAddresses

diff --git a/lib/RT/EmailParser.pm b/lib/RT/EmailParser.pm
index 69dec63..1264fad 100755
--- a/lib/RT/EmailParser.pm
+++ b/lib/RT/EmailParser.pm
@@ -362,16 +362,9 @@ Returns the same array with any IsRTAddress()es weeded out.
 
 sub CullRTAddresses {
     my $self = shift;
-    my @addresses= (@_);
-    my @addrlist;
-
-    foreach my $addr( @addresses ) {
-                                 # We use the class instead of the instance
-                                 # because sloppy code calls this method
-                                 # without a $self
-      push (@addrlist, $addr)    unless RT::EmailParser->IsRTAddress($addr);
-    }
-    return (@addrlist);
+    my @addresses = (@_);
+
+    return grep { !$self->IsRTAddress($_) } @addresses;
 }
 
 
diff --git a/t/api/emailparser.t b/t/api/emailparser.t
index 6861f8d..29550bd 100644
--- a/t/api/emailparser.t
+++ b/t/api/emailparser.t
@@ -14,5 +14,5 @@ is(RT::EmailParser::IsRTAddress("","frt\@example.com"),undef, "Regexp didn't mat
 
 my @before = ("rt\@example.com", "frt\@example.com");
 my @after = ("frt\@example.com");
-ok(eq_array(RT::EmailParser::CullRTAddresses("", at before), at after), "CullRTAddresses only culls RT addresses");
+ok(eq_array(RT::EmailParser->CullRTAddresses(@before), at after), "CullRTAddresses only culls RT addresses");
 

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


More information about the Rt-commit mailing list