[Bps-public-commit] r18741 - in Net-IMAP-Server: lib/Net/IMAP/Server

alexmv at bestpractical.com alexmv at bestpractical.com
Sun Mar 8 15:31:43 EDT 2009


Author: alexmv
Date: Sun Mar  8 15:31:43 2009
New Revision: 18741

Modified:
   Net-IMAP-Server/   (props changed)
   Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm

Log:
 r43063 at kohr-ah:  chmrr | 2009-03-08 15:31:31 -0400
 Factor out repeated regex


Modified: Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm
==============================================================================
--- Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm	(original)
+++ Net-IMAP-Server/lib/Net/IMAP/Server/Connection.pm	Sun Mar  8 15:31:43 2009
@@ -303,8 +303,9 @@
     my $self = shift;
     my $line = shift;
     $line =~ s/[\r\n]+$//;
-    unless ( $line =~ /^([^\(\)\{ \*\%"\\\+}]+)\s+(\w+)(?:\s+(.+?))?$/ ) {
-        if ( $line !~ /^([^\(\)\{ \*\%"\\\+}]+)\s+/ ) {
+    my $TAG = qr/([^\(\)\{ \*\%"\\\+}]+)/;
+    unless ( $line =~ /^$TAG\s+(\w+)(?:\s+(.+?))?$/ ) {
+        if ( $line !~ /^$TAG\s+/ ) {
             $self->out("* BAD Invalid tag");
         } else {
             $self->out("* BAD Null command ('$line')");



More information about the Bps-public-commit mailing list