[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-56-gf69e917

Alex Vandiver alexmv at bestpractical.com
Wed Jul 6 21:39:08 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  f69e917e54e0511e122718f150dab8d9cea22c45 (commit)
       via  472f475f885a77264dd1f3ea6aca073edf0183a8 (commit)
       via  b665273e6435193ce552d2dba76e4681a6103b55 (commit)
       via  cdf9f048e43dc9b9e40439bf100a19d0a38ae7db (commit)
       via  7349994d1f766a85f0e07d86bd28940a23bbd6ba (commit)
      from  b5fa88487d12b157897519525a99ed99270576e3 (commit)

Summary of changes:
 bin/mason_handler.svc.in                           |    2 +-
 bin/rt.in                                          |    6 ++--
 etc/upgrade/generate-rtaddressregexp.in            |    2 +-
 etc/upgrade/shrink_cgm_table.pl                    |    2 +-
 etc/upgrade/shrink_transactions_table.pl           |    2 +-
 etc/upgrade/split-out-cf-categories.in             |    2 +-
 etc/upgrade/vulnerable-passwords.in                |    2 +-
 lib/RT.pm.in                                       |    8 +-----
 lib/RT/Shredder/Plugin/Base.pm                     |    4 +-
 lib/RT/Transaction_Overlay.pm                      |    4 +-
 lib/RT/User_Overlay.pm                             |    7 +---
 sbin/rt-email-group-admin.in                       |    4 +-
 sbin/rt-setup-database.in                          |    2 +-
 sbin/rt-validator.in                               |   29 +++++++++++---------
 .../Admin/Tools/Shredder/Elements/PluginArguments  |    4 +-
 share/html/REST/1.0/Forms/ticket/attachments       |    6 ++--
 share/html/REST/1.0/Forms/ticket/history           |    6 ++--
 share/html/REST/1.0/Forms/transaction/default      |    6 ++--
 18 files changed, 46 insertions(+), 52 deletions(-)

- Log -----------------------------------------------------------------
commit 7349994d1f766a85f0e07d86bd28940a23bbd6ba
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 20:47:24 2011 -0400

    $, hasn't been a problem since Log::Dispatch 1.79; we require 2.0 in rt-test-dependencies

diff --git a/lib/RT.pm.in b/lib/RT.pm.in
index 84b16b1..41a6fd7 100755
--- a/lib/RT.pm.in
+++ b/lib/RT.pm.in
@@ -214,11 +214,6 @@ Create the Logger object and set up signal handlers.
 =cut
 
 sub InitLogging {
-
-    # We have to set the record separator ($, man perlvar)
-    # or Log::Dispatch starts getting
-    # really pissy, as some other module we use unsets it.
-    $, = '';
     use Log::Dispatch 1.6;
 
     my %level_to_num = (

commit cdf9f048e43dc9b9e40439bf100a19d0a38ae7db
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 20:48:14 2011 -0400

    Move the already-compile-time use line to the top; the version requirement is also superfluous
    
    rt-test-dependencies requires version 2.0 or higher already

diff --git a/lib/RT.pm.in b/lib/RT.pm.in
index 41a6fd7..7c7cd43 100755
--- a/lib/RT.pm.in
+++ b/lib/RT.pm.in
@@ -54,6 +54,7 @@ package RT;
 
 use File::Spec ();
 use Cwd ();
+use Log::Dispatch;
 
 use vars qw($Config $System $SystemUser $Nobody $Handle $Logger $_INSTALL_MODE);
 
@@ -214,8 +215,6 @@ Create the Logger object and set up signal handlers.
 =cut
 
 sub InitLogging {
-    use Log::Dispatch 1.6;
-
     my %level_to_num = (
         map( { $_ => } 0..7 ),
         debug     => 0,

commit b665273e6435193ce552d2dba76e4681a6103b55
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 20:51:04 2011 -0400

    Remove uses of lexical $a variable

diff --git a/bin/rt.in b/bin/rt.in
index a446f03..7298153 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -768,8 +768,8 @@ sub comment {
                 push @files, shift @ARGV;
             }
             elsif (/-([bc])/) {
-                my $a = $_ eq "-b" ? \@bcc : \@cc;
-                @$a = split /\s*,\s*/, shift @ARGV;
+                my $ref = $_ eq "-b" ? \@bcc : \@cc;
+                @$ref = split /\s*,\s*/, shift @ARGV;
             }
             elsif (/-m/) {
                 $msg = shift @ARGV;
diff --git a/lib/RT/Shredder/Plugin/Base.pm b/lib/RT/Shredder/Plugin/Base.pm
index d95279e..14a657a 100644
--- a/lib/RT/Shredder/Plugin/Base.pm
+++ b/lib/RT/Shredder/Plugin/Base.pm
@@ -122,8 +122,8 @@ sub HasSupportForArgs
     my $self = shift;
     my @args = @_;
     my @unsupported = ();
-    foreach my $a( @args ) {
-        push @unsupported, $a unless grep $_ eq $a, $self->SupportArgs;
+    foreach my $arg ( @args ) {
+        push @unsupported, $arg unless grep $_ eq $arg, $self->SupportArgs;
     }
     return( 1 ) unless @unsupported;
     return( 0, "Plugin doesn't support argument(s): @unsupported" ) if @unsupported;
diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index 6e89b10..ea6461d 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -591,9 +591,9 @@ sub ContentAsMIME {
         VALUE => 'multipart/',
     );
     $attachments->LimitNotEmpty;
-    while ( my $a = $attachments->Next ) {
+    while ( my $att = $attachments->Next ) {
         $entity->make_multipart unless $entity->is_multipart;
-        $entity->add_part( $a->ContentAsMIME );
+        $entity->add_part( $att->ContentAsMIME );
     }
     return $entity;
 }
diff --git a/lib/RT/User_Overlay.pm b/lib/RT/User_Overlay.pm
index 007a74b..a169a81 100755
--- a/lib/RT/User_Overlay.pm
+++ b/lib/RT/User_Overlay.pm
@@ -752,9 +752,6 @@ sub GenerateRandomPassword {
 
     my ( $frequency, $start_freq, $total_sum, $row_sums );
 
-    #When munging characters, we need to know where to start counting letters from
-    my $a = ord('a');
-
     # frequency of English digraphs (from D Edwards 1/27/66) 
     $frequency = [
         [
@@ -888,12 +885,12 @@ sub GenerateRandomPassword {
     my $length = $min_length + int( rand( $max_length - $min_length ) );
 
     my $char = $self->_GenerateRandomNextChar( $total_sum, $start_freq );
-    my @word = ( $char + $a );
+    my @word = ( $char + ord('a') );
     for ( 2 .. $length ) {
         $char =
           $self->_GenerateRandomNextChar( $row_sums->[$char],
             $frequency->[$char] );
-        push ( @word, $char + $a );
+        push ( @word, $char + ord('a') );
     }
 
     #Return the password
diff --git a/sbin/rt-email-group-admin.in b/sbin/rt-email-group-admin.in
index f66f70b..cd6f4a7 100755
--- a/sbin/rt-email-group-admin.in
+++ b/sbin/rt-email-group-admin.in
@@ -214,8 +214,8 @@ Lists actions and its descriptions.
 
 sub list {
     my $actions = _get_our_actions();
-    while( my $a = $actions->Next ) {
-        _list( $a );
+    while( my $action = $actions->Next ) {
+        _list( $action );
     }
     return;
 }
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 25fb7ed..3158d40 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -236,18 +236,19 @@ foreach my $table ( qw(Users Groups) ) {
             bind_values => [ $type ],
             action => sub {
                 my $id = shift;
-                return unless my $a = prompt_action( ['Delete', 'create'], $msg );
+                my $action = prompt_action( ['Delete', 'create'], $msg );
+                return unless $action;
 
-                if ( $a eq 'd' ) {
+                if ( $action eq 'd' ) {
                     delete_record( $table, $id );
                 }
-                elsif ( $a eq 'c' ) {
+                elsif ( $action eq 'c' ) {
                     my $principal_id = create_record( 'Principals',
                         id => $id, PrincipalType => $type, ObjectId => $id, Disabled => 0
                     );
                 }
                 else {
-                    die "Unknown action '$a'";
+                    die "Unknown action '$action'";
                 }
             },
         );
@@ -1072,8 +1073,8 @@ sub prompt {
 
     print $msg, "\n";
     print "$action ALL records with the same defect? [N]: ";
-    my $a = <STDIN>;
-    return $cached_answer{ $token } = 1 if $a =~ /^(y|yes)$/i;
+    my $input = <STDIN>;
+    return $cached_answer{ $token } = 1 if $input =~ /^(y|yes)$/i;
     return $cached_answer{ $token } = 0;
 } }
 
@@ -1089,11 +1090,11 @@ sub prompt_action {
 
     print $msg, "\n";
     print join( ' or ', @$actions ) ." ALL records with the same defect? [do nothing]: ";
-    my $a = <STDIN>;
-    chomp $a;
-    return $cached_answer{ $token } = '' unless $a;
-    foreach ( grep rindex(lc $_, lc $a, 0) == 0, @$actions ) {
-        return $cached_answer{ $token } = lc substr $a, 0, 1;
+    my $input = <STDIN>;
+    chomp $input;
+    return $cached_answer{ $token } = '' unless $input;
+    foreach ( grep rindex(lc $_, lc $input, 0) == 0, @$actions ) {
+        return $cached_answer{ $token } = lc substr $input, 0, 1;
     }
     return $cached_answer{ $token } = '';
 } }
@@ -1111,8 +1112,10 @@ sub prompt_integer {
 
     print $msg, "\n";
     print "$action ALL records with the same defect? [0]: ";
-    my $a = <STDIN>; chomp $a; $a = int($a);
-    return $cached_answer{ $token } = $a;
+    my $input = <STDIN>;
+    chomp $input;
+    $input = int($input);
+    return $cached_answer{ $token } = $input;
 } }
 
 1;
diff --git a/share/html/Admin/Tools/Shredder/Elements/PluginArguments b/share/html/Admin/Tools/Shredder/Elements/PluginArguments
index a83b0e6..30b519b 100644
--- a/share/html/Admin/Tools/Shredder/Elements/PluginArguments
+++ b/share/html/Admin/Tools/Shredder/Elements/PluginArguments
@@ -50,8 +50,8 @@ $Plugin => ''
 </%ARGS>
 <div id="shredder-plugin-<% $Plugin %>-arguments" class="shredder-form">
 <span><% loc('Fill arguments') %>:</span><br />
-% foreach my $a( $plugin_obj->SupportArgs ) {
-<span><% loc($a) %>:</span><input type="text" name="<% "$Plugin:$a" %>" value="<% $ARGS{ "$Plugin:$a" } || '' %>" /><br />
+% foreach my $arg ( $plugin_obj->SupportArgs ) {
+<span><% loc($arg) %>:</span><input type="text" name="<% "$Plugin:$arg" %>" value="<% $ARGS{ "$Plugin:$arg" } || '' %>" /><br />
 % }
 </div>
 <%INIT>
diff --git a/share/html/REST/1.0/Forms/ticket/attachments b/share/html/REST/1.0/Forms/ticket/attachments
index 6a3087b..52446d7 100755
--- a/share/html/REST/1.0/Forms/ticket/attachments
+++ b/share/html/REST/1.0/Forms/ticket/attachments
@@ -114,11 +114,11 @@ else {
     my $transactions = $ticket->Transactions;
     while (my $t = $transactions->Next) {
         my $attachments = $t->Attachments;
-        while (my $a = $attachments->Next) {
-            my $size = length($a->Content || '');
+        while (my $att = $attachments->Next) {
+            my $size = length($att->Content || '');
             if ($size > 1024) { $size  = int($size/102.4)/10 . "k" }
             else              { $size .= "b" }
-            push @attachments, $a->Id.": ".($a->Filename || '(Unnamed)')." (".$a->ContentType . " / ".$size.")";
+            push @attachments, $att->Id.": ".($att->Filename || '(Unnamed)')." (".$att->ContentType . " / ".$size.")";
         }
     }
 
diff --git a/share/html/REST/1.0/Forms/ticket/history b/share/html/REST/1.0/Forms/ticket/history
index fd9c677..77b9d14 100755
--- a/share/html/REST/1.0/Forms/ticket/history
+++ b/share/html/REST/1.0/Forms/ticket/history
@@ -147,11 +147,11 @@ if ($tid) {
     if (!%$fields || exists $fields->{lc 'Attachments'}) {
 	my $attachlist;
 	my $attachments = $t->Attachments;
-	while (my $a = $attachments->Next) {
-	    my $size = length($a->Content||'');
+	while (my $att = $attachments->Next) {
+	    my $size = length($att->Content||'');
 	    if ($size > 1024) { $size  = int($size/102.4)/10 . "k" }
 	    else              { $size .= "b" }
-	    $attachlist .= "\n" . $a->Id.": ".($a->Filename || "untitled")." (".$size.")";
+	    $attachlist .= "\n" . $att->Id.": ".($att->Filename || "untitled")." (".$size.")";
 	}
 	
 	push @data, [Attachments => $attachlist];
diff --git a/share/html/REST/1.0/Forms/transaction/default b/share/html/REST/1.0/Forms/transaction/default
index 7101e3d..3b7ea16 100644
--- a/share/html/REST/1.0/Forms/transaction/default
+++ b/share/html/REST/1.0/Forms/transaction/default
@@ -99,15 +99,15 @@ if ($tid) {
       if (!%$fields || exists $fields->{lc 'Attachments'}) {
   	    my $attachlist;
   	    my $attachments = $t->Attachments;
-  	    while (my $a = $attachments->Next) {
-  	      my $size = length($a->Content);
+  	    while (my $att = $attachments->Next) {
+  	      my $size = length($att->Content);
   	      if ($size > 1024) {
   	        $size  = int($size/102.4)/10 . "k";
   	      }
   	      else {
   	        $size .= "b";
   	      }
-  	      $attachlist .= "\n" . $a->Id.": ".($a->Filename || "untitled")." (".$size.")";
+  	      $attachlist .= "\n" . $att->Id.": ".($att->Filename || "untitled")." (".$size.")";
   	    }
   	    push @data, [Attachments => $attachlist];
       }

commit 472f475f885a77264dd1f3ea6aca073edf0183a8
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 20:51:48 2011 -0400

    local'ize all occurrences of $|

diff --git a/bin/rt.in b/bin/rt.in
index 7298153..c46c799 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -176,7 +176,7 @@ sub handler {
 # The following subs are handlers for each entry in %actions.
 
 sub shell {
-    $|=1;
+    local $| = 1;
     my $term = Term::ReadLine->new('RT CLI');
     while ( defined ($_ = $term->readline($prompt)) ) {
         next if /^#/ || /^\s*$/;
diff --git a/etc/upgrade/generate-rtaddressregexp.in b/etc/upgrade/generate-rtaddressregexp.in
index a0787ca..c48a011 100644
--- a/etc/upgrade/generate-rtaddressregexp.in
+++ b/etc/upgrade/generate-rtaddressregexp.in
@@ -57,7 +57,7 @@ RT::LoadConfig();
 RT->Config->Set('LogToScreen' => 'debug');
 RT::Init();
 
-$| = 1;
+local $| = 1;
 
 if (my $re = RT->Config->Get('RTAddressRegexp')) {
     print "No need to use this script, you already have RTAddressRegexp set to $re\n";
diff --git a/etc/upgrade/shrink_cgm_table.pl b/etc/upgrade/shrink_cgm_table.pl
index 0ce3d28..64614ff 100644
--- a/etc/upgrade/shrink_cgm_table.pl
+++ b/etc/upgrade/shrink_cgm_table.pl
@@ -89,7 +89,7 @@ $cgms->Limit(
     ENTRYAGGREGATOR => 'AND',
 );
 
-$| = 1;
+local $| = 1;
 my $total = $cgms->Count;
 my $i = 0;
 
diff --git a/etc/upgrade/shrink_transactions_table.pl b/etc/upgrade/shrink_transactions_table.pl
index b4f2e19..ab382f2 100644
--- a/etc/upgrade/shrink_transactions_table.pl
+++ b/etc/upgrade/shrink_transactions_table.pl
@@ -89,7 +89,7 @@ $txns->Limit(
     ENTRYAGGREGATOR => 'AND',
 );
 
-$| = 1;
+local $| = 1;
 my $total = $txns->Count;
 my $i = 0;
 
diff --git a/etc/upgrade/split-out-cf-categories.in b/etc/upgrade/split-out-cf-categories.in
index 9d157b4..fb7061e 100644
--- a/etc/upgrade/split-out-cf-categories.in
+++ b/etc/upgrade/split-out-cf-categories.in
@@ -57,7 +57,7 @@ RT::LoadConfig();
 RT->Config->Set('LogToScreen' => 'debug');
 RT::Init();
 
-$| = 1;
+local $| = 1;
 
 $RT::Handle->BeginTransaction();
 
diff --git a/etc/upgrade/vulnerable-passwords.in b/etc/upgrade/vulnerable-passwords.in
index 0af2b64..680488b 100755
--- a/etc/upgrade/vulnerable-passwords.in
+++ b/etc/upgrade/vulnerable-passwords.in
@@ -56,7 +56,7 @@ use RT;
 RT::LoadConfig;
 RT::Init;
 
-$| = 1;
+local $| = 1;
 
 use Getopt::Long;
 use Digest::SHA;
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 67424a8..32879ee 100755
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -87,7 +87,7 @@ BEGIN {
 use Term::ReadKey;
 use Getopt::Long;
 
-$| = 1; # unbuffer all output.
+local $| = 1; # unbuffer all output.
 
 my %args;
 GetOptions(

commit f69e917e54e0511e122718f150dab8d9cea22c45
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 20:52:43 2011 -0400

    'local' the signal handler, even though we'll never leave the scope, to make perlcritic happy

diff --git a/bin/mason_handler.svc.in b/bin/mason_handler.svc.in
index 119b110..5d9cae6 100755
--- a/bin/mason_handler.svc.in
+++ b/bin/mason_handler.svc.in
@@ -210,7 +210,7 @@ BEGIN {
 	exit;
     }
     elsif ($ARGV[0] ne '--run') {
-	$SIG{__DIE__} = sub { $ProcessObj->Kill(0) if $ProcessObj };
+	local $SIG{__DIE__} = sub { $ProcessObj->Kill(0) if $ProcessObj };
 	$runsvc->();
 	warn "RT FastCGI Handler launched. Press [Enter] to terminate...\n";
 	<STDIN>;

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


More information about the Rt-commit mailing list