[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-23-gcbec28a

Alex Vandiver alexmv at bestpractical.com
Wed Jun 29 16:46:01 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  cbec28a59298dcab9095f419f3597986eb10ebc7 (commit)
       via  2e566377ec63612fb8486b5501e7b54aa21e5ccf (commit)
       via  7586cc254448d86389312e231c2c51bbac7f767c (commit)
       via  7742aafe56321a7465d9bddbbb726d0da27e19b1 (commit)
      from  2e75855bc6a97c09ea61fcb55e9a56ad440f8704 (commit)

Summary of changes:
 bin/rt.in                             |   22 +++----
 lib/RT/Action/NotifyGroup.pm          |    7 ++-
 lib/RT/Config.pm                      |    2 +-
 lib/RT/CustomField_Overlay.pm         |    2 +-
 lib/RT/Graph/Tickets.pm               |    2 +-
 lib/RT/Interface/CLI.pm               |   98 ++++++++++++++++----------------
 lib/RT/Interface/Web.pm               |   18 +++---
 lib/RT/Search/Googleish.pm            |    4 +-
 lib/RT/Shredder/Plugin/Attachments.pm |    2 +-
 lib/RT/Test.pm                        |    2 +-
 sbin/extract-message-catalog          |   24 +++++---
 sbin/factory                          |   15 +++--
 sbin/license_tag                      |   48 ++++++++--------
 13 files changed, 129 insertions(+), 117 deletions(-)

- Log -----------------------------------------------------------------
commit 7742aafe56321a7465d9bddbbb726d0da27e19b1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 15:43:53 2011 -0400

    Don't use bareword filehandles

diff --git a/bin/rt.in b/bin/rt.in
index aefe7af..2c84e0c 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1164,12 +1164,11 @@ sub submit {
     sub load {
         my ($self, $file) = @_;
         $file ||= $self->{file};
-        local *F;
 
-        open(F, '<', $file) && do {
+        open(my $f, '<', $file) && do {
             $self->{file} = $file;
             my $sids = $self->{sids} = {};
-            while (<F>) {
+            while (<$f>) {
                 chomp;
                 next if /^$/ || /^#/;
                 next unless m#^https?://[^ ]+ \w+ [^;,\s]+=[0-9A-Fa-f]+$#;
@@ -1185,19 +1184,18 @@ sub submit {
     sub save {
         my ($self, $file) = shift;
         $file ||= $self->{file};
-        local *F;
 
-        open(F, '>', $file) && do {
+        open(my $f, '>', $file) && do {
             my $sids = $self->{sids};
             foreach my $server (keys %$sids) {
                 foreach my $user (keys %{ $sids->{$server} }) {
                     my $sid = $sids->{$server}{$user};
                     if (defined $sid) {
-                        print F "$server $user $sid\n";
+                        print $f "$server $user $sid\n";
                     }
                 }
             }
-            close(F);
+            close($f);
             chmod 0600, $file;
             return 1;
         };
@@ -1429,8 +1427,8 @@ sub parse_config_file {
     my ($file) = @_;
     local $_; # $_ may be aliased to a constant, from line 1163
 
-    open(CFG, '<', $file) && do {
-        while (<CFG>) {
+    open(my $cfg, '<', $file) && do {
+        while (<$cfg>) {
             chomp;
             next if (/^#/ || /^\s*$/);
 
@@ -1476,12 +1474,12 @@ sub vi {
     my $file = "/tmp/rt.form.$$";
     my $editor = $ENV{EDITOR} || $ENV{VISUAL} || "vi";
 
-    local *F;
     local $/ = undef;
+    my $f;
 
-    open(F, '>', $file) or die "$file: $!\n"; print F $text; close(F);
+    open($f, '>', $file) or die "$file: $!\n"; print $f $text; close($f);
     system($editor, $file) && die "Couldn't run $editor.\n";
-    open(F, '<', $file) or die "$file: $!\n"; $text = <F>; close(F);
+    open($f, '<', $file) or die "$file: $!\n"; $text = <$f>; close($f);
     unlink($file);
 
     return $text;
diff --git a/lib/RT/Interface/CLI.pm b/lib/RT/Interface/CLI.pm
index e56cae5..9d7d32b 100755
--- a/lib/RT/Interface/CLI.pm
+++ b/lib/RT/Interface/CLI.pm
@@ -200,9 +200,9 @@ sub GetMessageContent {
     
     #Load the sourcefile, if it's been handed to us
     if ($source) {
-    open( SOURCE, '<', $source ) or die $!;
-	@lines = (<SOURCE>) or die $!;
-	close (SOURCE) or die $!;
+        open( my $fh, '<', $source ) or die $!;
+	@lines = (<$fh>) or die $!;
+	close ($fh) or die $!;
     }
     elsif ($args{'Content'}) {
 	@lines = split('\n',$args{'Content'});
@@ -226,9 +226,9 @@ sub GetMessageContent {
 	system ($ENV{'EDITOR'}, $filename);
     }	
     
-    open( READ, '<', $filename ) or die $!;
-    my @newlines = (<READ>);
-    close (READ) or die $!;
+    open( $fh, '<', $filename ) or die $!;
+    my @newlines = (<$fh>);
+    close ($fh) or die $!;
 
     unlink ($filename) unless (debug());
     return(\@newlines);
diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index f6a7f85..ea49be6 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -105,7 +105,6 @@ foreach my $dict (@ARGV) {
 sub extract_strings_from_code {
     my $file = $_;
 
-    local $/;
     return if ( -d $_ );
     return
       if ( $File::Find::dir =~
@@ -120,10 +119,14 @@ sub extract_strings_from_code {
     $filename =~ s'^\./'';
     $filename =~ s'\.in$'';
 
-    unless (open _, '<', $file) {
+    my $fh;
+    unless (open $fh, '<', $file) {
         print "Cannot open $file for reading ($!), skipping.\n";
         return;
     }
+    local $/;
+    $_ = <$fh>;
+    close $fh;
 
     my $re_space_wo_nl = qr{(?!\n)\s};
     my $re_loc_suffix = qr{$re_space_wo_nl* \# $re_space_wo_nl* loc $re_space_wo_nl* $}mx;
@@ -132,7 +135,6 @@ sub extract_strings_from_code {
     my $re_loc_left_pair_suffix = qr{$re_space_wo_nl* \# $re_space_wo_nl* loc_left_pair $re_space_wo_nl* $}mx;
     my $re_delim = $RE{delimited}{-delim=>q{'"}}{-keep};
 
-    $_ = <_>;
 
     # Mason filter: <&|/l>...</&>
     my $line = 1;
@@ -231,7 +233,6 @@ sub extract_strings_from_code {
 	push @{ $FILECAT->{$val} }, [ $filename, $line, '' ];
     }
 
-    close (_);
 }
 # }}} extract from strings
 
@@ -249,7 +250,8 @@ sub update {
     print "Updating $lang...\n";
 
     my @lines;
-    @lines = (<LEXICON>) if open LEXICON, '<', $file;
+    my $lexicon_fh;
+    @lines = (<$lexicon_fh>) if open $lexicon_fh, '<', $file;
     @lines = grep { !/^(#(:|\.)\s*|$)/ } @lines;
     while (@lines) {
         my $msghdr = "";
@@ -343,9 +345,9 @@ sub update {
         $out .= 'msgid ' . fmt($_) . "msgstr \"$Lexicon{$_}\"\n\n";
     }
 
-    open( PO, '>', $file ) or die "Couldn't open '$file' for writing: $!";
-    print PO $out;
-    close PO;
+    open( my $po, '>', $file ) or die "Couldn't open '$file' for writing: $!";
+    print $po $out;
+    close $po;
 
     return 1;
 }
diff --git a/sbin/factory b/sbin/factory
index a1d1f3e..418377c 100755
--- a/sbin/factory
+++ b/sbin/factory
@@ -452,13 +452,14 @@ $ClassAccessible
     print "About to make $RecordClassPath, $CollectionClassPath\n";
     `mkdir -p $path`;
 
-    open( RECORD, '>', $RecordClassPath ) or die $!;
-    print RECORD $RecordClass;
-    close(RECORD);
-
-    open( COL, '>', $CollectionClassPath ) or die $!;
-    print COL $CollectionClass;
-    close(COL);
+    my $fh;
+    open( $fh, '>', $RecordClassPath ) or die $!;
+    print $fh $RecordClass;
+    close($fh);
+
+    open( $fh, '>', $CollectionClassPath ) or die $!;
+    print $fh $CollectionClass;
+    close($fh);
 
 }
 
diff --git a/sbin/license_tag b/sbin/license_tag
index 9ddf82e..5bffecb 100755
--- a/sbin/license_tag
+++ b/sbin/license_tag
@@ -113,9 +113,9 @@ sub tag_mason {
         my $pm = $_;
         return unless (-f $pm);
         return if $pm =~ /images/ || $pm =~ /\.(?:png|jpe?g|gif)$/;
-        open( FILE, '<', $pm ) or die "Failed to open $pm";
-        my $file = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        my $file = (join "", <$fh>);
+        close ($fh);
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -137,18 +137,18 @@ sub tag_mason {
 
 
 
-        open( FILE, '>', $pm ) or die "couldn't write new file";
-        print FILE $file;
-        close FILE;
+        open( $fh, '>', $pm ) or die "couldn't write new file";
+        print $fh $file;
+        close $fh;
 
 }
 
 
 sub tag_makefile {
         my $pm = shift;
-        open( FILE, '<', $pm ) or die "Failed to open $pm";
-        my $file = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        my $file = (join "", <$fh>);
+        close ($fh);
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -170,9 +170,9 @@ sub tag_makefile {
 
 
 
-        open( FILE, '>', $pm ) or die "couldn't write new file";
-        print FILE $file;
-        close FILE;
+        open( $fh, '>', $pm ) or die "couldn't write new file";
+        print $fh $file;
+        close $fh;
 
 }
 
@@ -180,9 +180,9 @@ sub tag_makefile {
 sub tag_pm {
         my $pm = $_;
         next unless $pm =~ /\.pm/s;
-        open( FILE, '<', $pm ) or die "Failed to open $pm";
-        my $file = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        my $file = (join "", <$fh>);
+        close ($fh);
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -204,9 +204,9 @@ sub tag_pm {
 
 
 
-        open( FILE, '>', $pm ) or die "couldn't write new file $pm";
-        print FILE $file;
-        close FILE;
+        open( $fh, '>', $pm ) or die "couldn't write new file $pm";
+        print $fh $file;
+        close $fh;
 
 }
 
@@ -214,9 +214,9 @@ sub tag_pm {
 sub tag_script {
         my $pm = $_;
         return unless (-f $pm);
-        open( FILE, '<', $pm ) or die "Failed to open $pm";
-        my $file = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        my $file = (join "", <$fh>);
+        close ($fh);
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -241,9 +241,9 @@ sub tag_script {
         print "\n";
 
 
-        open( FILE, '>', $pm ) or die "couldn't write new file";
-        print FILE $file;
-        close FILE;
+        open( $fh, '>', $pm ) or die "couldn't write new file";
+        print $fh $file;
+        close $fh;
 
 }
 

commit 7586cc254448d86389312e231c2c51bbac7f767c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 15:45:56 2011 -0400

    Cleanup some notably horrid whitespace problems

diff --git a/lib/RT/Interface/CLI.pm b/lib/RT/Interface/CLI.pm
index 9d7d32b..32d3269 100755
--- a/lib/RT/Interface/CLI.pm
+++ b/lib/RT/Interface/CLI.pm
@@ -56,14 +56,14 @@ package RT::Interface::CLI;
 BEGIN {
     use base 'Exporter';
     use vars qw ($VERSION  @EXPORT @EXPORT_OK %EXPORT_TAGS);
-    
+
     # set the version for version checking
     $VERSION = do { my @r = (q$Revision: 1.2.2.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
 
     # your exported package globals go here,
     # as well as any optionally exported functions
-    @EXPORT_OK   = qw(&CleanEnv 
-		      &GetCurrentUser &GetMessageContent &debug &loc);
+    @EXPORT_OK   = qw(&CleanEnv
+                      &GetCurrentUser &GetMessageContent &debug &loc);
 }
 
 =head1 NAME
@@ -74,8 +74,8 @@ BEGIN {
 
   use lib "/path/to/rt/libraries/";
 
-  use RT::Interface::CLI  qw(CleanEnv 
-	  		   GetCurrentUser GetMessageContent loc);
+  use RT::Interface::CLI  qw(CleanEnv
+                           GetCurrentUser GetMessageContent loc);
 
   #Clean out all the nasties from the environment
   CleanEnv();
@@ -111,10 +111,10 @@ Removes some of the nastiest nasties from the user\'s environment.
 
 sub CleanEnv {
     $ENV{'PATH'} = '/bin:/usr/bin';    # or whatever you need
-    $ENV{'CDPATH'} = '' if defined $ENV{'CDPATH'};
-    $ENV{'SHELL'} = '/bin/sh' if defined $ENV{'SHELL'};
-    $ENV{'ENV'} = '' if defined $ENV{'ENV'};
-    $ENV{'IFS'} = ''		if defined $ENV{'IFS'};
+    $ENV{'CDPATH'} = ''        if defined $ENV{'CDPATH'};
+    $ENV{'SHELL'}  = '/bin/sh' if defined $ENV{'SHELL'};
+    $ENV{'ENV'}    = ''        if defined $ENV{'ENV'};
+    $ENV{'IFS'}    = ''        if defined $ENV{'IFS'};
 }
 
 
@@ -124,7 +124,7 @@ sub CleanEnv {
 
     my $CurrentUser; # shared betwen GetCurrentUser and loc
 
-# {{{ sub GetCurrentUser 
+# {{{ sub GetCurrentUser
 
 =head2 GetCurrentUser
 
@@ -134,11 +134,11 @@ loaded with that user.  if the current user isn't found, returns a copy of RT::N
 =cut
 
 sub GetCurrentUser  {
-    
+
     require RT::CurrentUser;
-    
+
     #Instantiate a user object
-    
+
     my $Gecos= ($^O eq 'MSWin32') ? Win32::LoginName() : (getpwuid($<))[0];
 
     #If the current user is 0, then RT will assume that the User object
@@ -146,9 +146,9 @@ sub GetCurrentUser  {
 
     $CurrentUser = new RT::CurrentUser();
     $CurrentUser->LoadByGecos($Gecos);
-    
+
     unless ($CurrentUser->Id) {
-	$RT::Logger->debug("No user with a unix login of '$Gecos' was found. ");
+        $RT::Logger->debug("No user with a unix login of '$Gecos' was found. ");
     }
 
     return($CurrentUser);
@@ -156,7 +156,7 @@ sub GetCurrentUser  {
 # }}}
 
 
-# {{{ sub loc 
+# {{{ sub loc
 
 =head2 loc
 
@@ -178,61 +178,61 @@ sub loc {
 =head2 GetMessageContent
 
 Takes two arguments a source file and a boolean "edit".  If the source file
-is undef or "", assumes an empty file.  Returns an edited file as an 
+is undef or "", assumes an empty file.  Returns an edited file as an
 array of lines.
 
 =cut
 
 sub GetMessageContent {
     my %args = (  Source => undef,
-		  Content => undef,
-		  Edit => undef,
-		  CurrentUser => undef,
-		 @_);
+                  Content => undef,
+                  Edit => undef,
+                  CurrentUser => undef,
+                 @_);
     my $source = $args{'Source'};
 
     my $edit = $args{'Edit'};
-    
+
     my $currentuser = $args{'CurrentUser'};
     my @lines;
 
     use File::Temp qw/ tempfile/;
-    
+
     #Load the sourcefile, if it's been handed to us
     if ($source) {
         open( my $fh, '<', $source ) or die $!;
-	@lines = (<$fh>) or die $!;
-	close ($fh) or die $!;
+        @lines = (<$fh>) or die $!;
+        close ($fh) or die $!;
     }
     elsif ($args{'Content'}) {
-	@lines = split('\n',$args{'Content'});
+        @lines = split('\n',$args{'Content'});
     }
     #get us a tempfile.
     my ($fh, $filename) = tempfile();
-	
+
     #write to a tmpfile
     for (@lines) {
-	print $fh $_;
+        print $fh $_;
     }
     close ($fh) or die $!;
-    
+
     #Edit the file if we need to
-    if ($edit) {	
-
-	unless ($ENV{'EDITOR'}) {
-	    $RT::Logger->crit('No $EDITOR variable defined');
-	    return undef;
-	}
-	system ($ENV{'EDITOR'}, $filename);
-    }	
-    
+    if ($edit) {
+
+        unless ($ENV{'EDITOR'}) {
+            $RT::Logger->crit('No $EDITOR variable defined');
+            return undef;
+        }
+        system ($ENV{'EDITOR'}, $filename);
+    }
+
     open( $fh, '<', $filename ) or die $!;
     my @newlines = (<$fh>);
     close ($fh) or die $!;
 
     unlink ($filename) unless (debug());
     return(\@newlines);
-    
+
 }
 
 # }}}
@@ -243,14 +243,14 @@ sub debug {
     my $val = shift;
     my ($debug);
     if ($val) {
-	$RT::Logger->debug($val);
-	if ($debug) {
-	    print STDERR "$val\n";
-	}
+        $RT::Logger->debug($val);
+        if ($debug) {
+            print STDERR "$val\n";
+        }
     }
     if ($debug) {
-	return(1);
-    }	
+        return(1);
+    }
 }
 
 # }}}

commit 2e566377ec63612fb8486b5501e7b54aa21e5ccf
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 16:01:56 2011 -0400

    Use explicit glob() function, instead of <*>

diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index ea49be6..0f7d085 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -60,7 +60,11 @@ use vars qw($DEBUG $FILECAT);
 $DEBUG = 1;
 
 # po dir is for extensions
- at ARGV = (<lib/RT/I18N/*.po>, <lib/RT/I18N/*.pot>, <po/*.po>, <po/*.pot>) unless @ARGV;
+ at ARGV = (glob "lib/RT/I18N/*.po",
+         glob "lib/RT/I18N/*.pot",
+         glob "po/*.po",
+         glob "po/*.pot"
+     ) unless @ARGV;
 
 $FILECAT = {};
 

commit cbec28a59298dcab9095f419f3597986eb10ebc7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 16:26:28 2011 -0400

    Don't modify $_ in map and grep

diff --git a/lib/RT/Action/NotifyGroup.pm b/lib/RT/Action/NotifyGroup.pm
index a0efd5b..6bd903f 100644
--- a/lib/RT/Action/NotifyGroup.pm
+++ b/lib/RT/Action/NotifyGroup.pm
@@ -182,7 +182,12 @@ sub __HandleGroupArgument {
 }
 
 sub __SplitArg {
-    return grep length, map {s/^\s+//; s/\s+$//; $_} split /,/, $_[1];
+    return grep length, map {
+        my $arg = $_;
+        $arg =~ s/^\s+//;
+        $arg =~ s/\s+$//;
+        $arg;
+    } split /,/, $_[1];
 }
 
 sub __PushUserAddress {
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index ff93c84..b51e14c 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -655,7 +655,7 @@ sub Configs {
         my @files = glob $mask;
         @files = grep !/^RT_Config\.pm$/,
             grep $_ && /^\w+_Config\.pm$/,
-            map { s/^.*[\\\/]//; $_ } @files;
+            map { m/^.*[\\\/](.*)/ ? $1 : $_ } @files;
         push @configs, sort @files;
     }
 
diff --git a/lib/RT/CustomField_Overlay.pm b/lib/RT/CustomField_Overlay.pm
index a35c3c1..92a05ec 100755
--- a/lib/RT/CustomField_Overlay.pm
+++ b/lib/RT/CustomField_Overlay.pm
@@ -882,7 +882,7 @@ sub FriendlyLookupType {
     return ($self->loc( $FRIENDLY_OBJECT_TYPES{$lookup} ))
                      if (defined  $FRIENDLY_OBJECT_TYPES{$lookup} );
 
-    my @types = map { s/^RT::// ? $self->loc($_) : $_ }
+    my @types = map { m/^RT::(.*)/ ? $self->loc($1) : $_ }
       grep { defined and length }
       split( /-/, $lookup )
       or return;
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index cab4299..2c4e5c2 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -233,7 +233,7 @@ sub AddTicket {
     my @fields = $self->_PropertiesToFields( %args );
     if ( @fields ) {
         unshift @fields, $args{'Ticket'}->id;
-        my $label = join ' | ', map { s/(?=[{}|><])/\\/g; $_ } @fields;
+        my $label = join ' | ', map { my $f = $_; $f =~ s/(?=[{}|><])/\\/g; $f } @fields;
         $label = "{ $label }" if ($args{'Direction'} || 'TB') =~ /^(?:TB|BT)$/;
         $node_style{'label'} = gv_escape( $label );
         $node_style{'shape'} = 'record';
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 5c2e95c..e2cfb0f 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1215,10 +1215,11 @@ sub CreateTicket {
                 @values = split /\r*\n/, $ARGS{$arg};
             }
             @values = grep length, map {
-                s/\r+\n/\n/g;
-                s/^\s+//;
-                s/\s+$//;
-                $_;
+                my $value = $_;
+                $value =~ s/\r+\n/\n/g;
+                $value =~ s/^\s+//;
+                $value =~ s/\s+$//;
+                $value;
                 }
                 grep defined, @values;
 
@@ -1863,10 +1864,11 @@ sub _ProcessObjectCustomFieldUpdates {
                 if defined $args{'ARGS'}->{$arg};
         }
         @values = grep length, map {
-            s/\r+\n/\n/g;
-            s/^\s+//;
-            s/\s+$//;
-            $_;
+            my $value = $_;
+            $value =~ s/\r+\n/\n/g;
+            $value =~ s/^\s+//;
+            $value =~ s/\s+$//;
+            $value;
             }
             grep defined, @values;
 
diff --git a/lib/RT/Search/Googleish.pm b/lib/RT/Search/Googleish.pm
index 3174800..e76393d 100644
--- a/lib/RT/Search/Googleish.pm
+++ b/lib/RT/Search/Googleish.pm
@@ -95,7 +95,7 @@ sub QueryToSQL {
     my $self     = shift;
     my $query    = shift || $self->Argument;
 
-    my @keywords = grep length, map { s/^\s+//; s/\s+$//; $_ }
+    my @keywords = grep length, map { my $word = $_; $word =~ s/^\s+//; $word =~ s/\s+$//; $word }
         split /((?:fulltext:)?$re_delim|\s+)/o, $query;
 
     my (
@@ -185,7 +185,7 @@ sub QueryToSQL {
     }
     push @tql_clauses, join( " OR ", sort @user_clauses );
     push @tql_clauses, join( " OR ", sort @queue_clauses );
-    @tql_clauses = grep { $_ ? $_ = "( $_ )" : undef } @tql_clauses;
+    @tql_clauses = map {"( $_ )"} grep { $_ } @tql_clauses;
     return join " AND ", sort @tql_clauses;
 }
 # }}}
diff --git a/lib/RT/Shredder/Plugin/Attachments.pm b/lib/RT/Shredder/Plugin/Attachments.pm
index b2c8832..3cbadea 100644
--- a/lib/RT/Shredder/Plugin/Attachments.pm
+++ b/lib/RT/Shredder/Plugin/Attachments.pm
@@ -132,7 +132,7 @@ sub Run
     }
     return (0, "Internal error: '". $sth->err ."'. Please send bug report.") if $sth->err;
 
-    map { $_ = "RT::Attachment-$_" } @objs;
+    @objs = map { "RT::Attachment-$_" } @objs;
 
     return (1, @objs);
 }
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index ce49635..47e4e28 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1150,7 +1150,7 @@ sub apache_server_info {
     %res = (%res, %opts);
 
     $res{'modules'} = [
-        map {s/^\s+//; s/\s+$//; $_}
+        map {my $mod = $_; $mod =~ s/^\s+//; $mod =~ s/\s+$//; $mod}
         grep $_ !~ /Compiled in modules/i,
         split /\r*\n/, `$bin -l`
     ];
diff --git a/sbin/factory b/sbin/factory
index 418377c..afa52a1 100755
--- a/sbin/factory
+++ b/sbin/factory
@@ -129,7 +129,7 @@ my $dsn = "DBI:$driver:database=$database;host=$hostname";
 my $dbh = DBI->connect( $dsn, $user, $password );
 
 #get all tables out of database
-my @tables = map { s/^\`\Q$database\E\`\.//; $_ } $dbh->tables();
+my @tables = map { m/^\`\Q$database\E\`\.(.*)/ ? $1 : $_ } $dbh->tables();
 
 my ( %tablemap, $typemap, %modulemap );
 

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


More information about the Rt-commit mailing list