[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-48-gb32a6cc

Alex Vandiver alexmv at bestpractical.com
Wed Jul 6 17:23:33 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  b32a6cc69d5063514e1401eba5e1b53587bd42de (commit)
       via  d6fb4d67ff1baeb24c04df32c63c0c78394957a3 (commit)
       via  a6df2b7ce30087892db2ba87c96178b0e31f7888 (commit)
       via  dab6601ce067b1e15e0ff10944d791bbb4cc552e (commit)
      from  dbcda6b95941c6f7e1f25464c8f318774f4e2ea9 (commit)

Summary of changes:
 bin/fastcgi_server.in        |    1 -
 bin/mason_handler.fcgi.in    |    1 -
 bin/rt-crontool.in           |    3 +--
 bin/standalone_httpd.in      |    3 +--
 bin/webmux.pl.in             |    3 +--
 lib/RT/Attachment_Overlay.pm |    4 ++--
 lib/RT/Interface/Web.pm      |    3 +--
 lib/RT/Record.pm             |   12 +++++++-----
 lib/RT/Test.pm               |    1 -
 sbin/rt-attributes-viewer.in |    5 ++---
 sbin/rt-clean-sessions.in    |    3 +--
 sbin/rt-dump-database.in     |    3 +--
 sbin/rt-email-dashboards.in  |   11 ++++++-----
 sbin/rt-email-digest.in      |    3 +--
 sbin/rt-email-group-admin.in |    3 +--
 sbin/rt-server.in            |    3 +--
 sbin/rt-setup-database.in    |    3 +--
 sbin/rt-shredder.in          |    3 +--
 sbin/rt-test-dependencies.in |    2 +-
 sbin/rt-validator.in         |    3 +--
 share/html/Search/Chart      |   21 ++++++---------------
 21 files changed, 36 insertions(+), 58 deletions(-)

- Log -----------------------------------------------------------------
commit dab6601ce067b1e15e0ff10944d791bbb4cc552e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 16:16:20 2011 -0400

    Remove "no warnings" lines where possible

diff --git a/bin/fastcgi_server.in b/bin/fastcgi_server.in
index d6df63c..ac241e8 100644
--- a/bin/fastcgi_server.in
+++ b/bin/fastcgi_server.in
@@ -159,7 +159,6 @@ Server config:
 
 use strict;
 use warnings;
-no warnings qw(once);
 
 package RT::Interface::Web::FCGI::Server;
 use base qw(FCGI::ProcManager);
diff --git a/bin/mason_handler.fcgi.in b/bin/mason_handler.fcgi.in
index 4682abf..aa36754 100755
--- a/bin/mason_handler.fcgi.in
+++ b/bin/mason_handler.fcgi.in
@@ -48,7 +48,6 @@
 # END BPS TAGGED BLOCK }}}
 use strict;
 use warnings;
-no warnings qw(once);
 
 use File::Basename;
 require (dirname(__FILE__) .'/webmux.pl');
diff --git a/lib/RT/Attachment_Overlay.pm b/lib/RT/Attachment_Overlay.pm
index c8a4952..5bc4286 100644
--- a/lib/RT/Attachment_Overlay.pm
+++ b/lib/RT/Attachment_Overlay.pm
@@ -349,8 +349,8 @@ sub ContentLength {
     my $len = $self->GetHeader('Content-Length');
     unless ( defined $len ) {
         use bytes;
-        no warnings 'uninitialized';
-        $len = length($self->Content);
+        my $content = $self->Content;
+        $len = defined $content ? length($content) : 0;
         $self->SetHeader('Content-Length' => $len);
     }
     return $len;
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 80dfd4d..b6ffccc 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1210,8 +1210,7 @@ sub CreateTicket {
                 @values = @{ $ARGS{$arg} };
             } elsif ( $type =~ /text/i ) {
                 @values = ( $ARGS{$arg} );
-            } else {
-                no warnings 'uninitialized';
+            } elsif ( defined $ARGS{$arg} ) {
                 @values = split /\r*\n/, $ARGS{$arg};
             }
             @values = grep length, map {
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index e8a52f9..c85c879 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -883,15 +883,17 @@ sub Update {
         # and might not have a Name method. But "can" won't find autoloaded
         # items. If it fails, we don't care
         do {
-            no warnings "uninitialized";
             local $@;
+
+            my $current = $self->$attribute();
             eval {
                 my $object = $attribute . "Obj";
-                my $name = $self->$object->Name;
-                next if $name eq $value || $name eq ($value || 0);
+                $current = $self->$object->Name;
             };
-            next if $value eq $self->$attribute();
-            next if ($value || 0) eq $self->$attribute();
+
+            $current = '' unless defined $current;
+            next if (defined $value ? $value : '') eq $current;
+            next if ($value || 0) eq $current;
         };
 
         my $method = "Set$attribute";
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 8611887..c19b1d2 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -552,7 +552,6 @@ sub load_or_create_queue {
             next unless exists $args{ $field };
             next if $args{ $field } eq $obj->$field;
             
-            no warnings 'uninitialized';
             my $method = 'Set'. $field;
             my ($val, $msg) = $obj->$method( $args{ $field } );
             die "$msg" unless $val;
diff --git a/sbin/rt-attributes-viewer.in b/sbin/rt-attributes-viewer.in
index ce9f5f7..dd00548 100644
--- a/sbin/rt-attributes-viewer.in
+++ b/sbin/rt-attributes-viewer.in
@@ -95,7 +95,7 @@ RT::LoadConfig();
 RT::Init();
 
 require RT::Attribute;
-my $attr = RT::Attribute->new( do { no warnings 'once'; $RT::SystemUser } );
+my $attr = RT::Attribute->new( RT->SystemUser );
 $attr->Load( $id );
 unless ( $attr->id ) {
     print STDERR "Couldn't load attribute #$id\n";
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 703d2d9..7825b5a 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -52,7 +52,7 @@
 #
 
 use strict;
-no warnings qw(numeric redefine);
+use warnings;
 use Getopt::Long;
 my %args;
 my %deps;

commit a6df2b7ce30087892db2ba87c96178b0e31f7888
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 17:22:55 2011 -0400

    There is no need to override pick_data_clr; GD::Graph provides enough rope
    
    This was originally done to allow for explicit RGB hex specification of
    the colors -- but that is something which GR::Graph already allows,
    hence there is no need to blat pick_data_clr to allow it.

diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index 7bcb8d0..fb62536 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -168,21 +168,12 @@ if ($chart_class eq "GD::Graph::bars") {
 }
 
 # refine values' colors, with both Color::Scheme's help and my own tweak
-$chart->{dclrs} = [
-    '66cc66', 'ff6666', 'ffcc66', '663399',
-    '3333cc', 
-    '339933', '993333', '996633', '663399',
-    '33cc33', 'cc3333', 'cc9933', '6633cc'
-];
-
-{
-    no warnings 'redefine';
-    *GD::Graph::pick_data_clr = sub {
-        my $self      = shift;
-        my $color_hex = $self->{dclrs}[ $_[0] % @{ $self->{dclrs} } - 1 ];
-        return map { hex } ( $color_hex =~ /(..)(..)(..)/ );
-    };
-}
+$chart->set( dclrs => [
+    '#66cc66', '#ff6666', '#ffcc66', '#663399',
+    '#3333cc',
+    '#339933', '#993333', '#996633', '#663399',
+    '#33cc33', '#cc3333', '#cc9933', '#6633cc'
+] );
 
 my $plot = $chart->plot( [ [sort keys %data], [map $data{$_}, sort keys %data] ] ) or die $chart->error;
 $m->comp( 'SELF:Plot', plot => $plot, %ARGS );

commit d6fb4d67ff1baeb24c04df32c63c0c78394957a3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 16:42:02 2011 -0400

    Remove several 'no warnings "once"' lines in script boilerplate

diff --git a/bin/rt-crontool.in b/bin/rt-crontool.in
index 459ebf3..23c467b 100755
--- a/bin/rt-crontool.in
+++ b/bin/rt-crontool.in
@@ -63,8 +63,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/bin/standalone_httpd.in b/bin/standalone_httpd.in
index 8c8c1ae..a0cd7d4 100755
--- a/bin/standalone_httpd.in
+++ b/bin/standalone_httpd.in
@@ -63,8 +63,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/bin/webmux.pl.in b/bin/webmux.pl.in
index 7aae041..4b08f39 100755
--- a/bin/webmux.pl.in
+++ b/bin/webmux.pl.in
@@ -147,8 +147,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-attributes-viewer.in b/sbin/rt-attributes-viewer.in
index dd00548..9df430a 100644
--- a/sbin/rt-attributes-viewer.in
+++ b/sbin/rt-attributes-viewer.in
@@ -63,8 +63,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-clean-sessions.in b/sbin/rt-clean-sessions.in
index 4ec6c49..9ededb2 100644
--- a/sbin/rt-clean-sessions.in
+++ b/sbin/rt-clean-sessions.in
@@ -63,8 +63,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-dump-database.in b/sbin/rt-dump-database.in
index b913f2e..099917d 100755
--- a/sbin/rt-dump-database.in
+++ b/sbin/rt-dump-database.in
@@ -66,8 +66,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 50dad2f..89282a5 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -63,8 +63,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-email-digest.in b/sbin/rt-email-digest.in
index 5730717..5b5cf27 100644
--- a/sbin/rt-email-digest.in
+++ b/sbin/rt-email-digest.in
@@ -62,8 +62,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-email-group-admin.in b/sbin/rt-email-group-admin.in
index f7e0795..f66f70b 100755
--- a/sbin/rt-email-group-admin.in
+++ b/sbin/rt-email-group-admin.in
@@ -100,8 +100,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-server.in b/sbin/rt-server.in
index bf6da6e..02a324f 100644
--- a/sbin/rt-server.in
+++ b/sbin/rt-server.in
@@ -63,8 +63,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 98111d4..67424a8 100755
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -65,8 +65,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-shredder.in b/sbin/rt-shredder.in
index 8443642..c835c7b 100755
--- a/sbin/rt-shredder.in
+++ b/sbin/rt-shredder.in
@@ -124,8 +124,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 08b4d07..25fb7ed 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -63,8 +63,7 @@ BEGIN {
                 }
                 else {
                     require FindBin;
-                    no warnings "once";
-                    $bin_path = $FindBin::Bin;
+                    $bin_path = do { package FindBin; our $Bin; };
                 }
             }
             $lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );

commit b32a6cc69d5063514e1401eba5e1b53587bd42de
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 16:42:53 2011 -0400

    Remove a 'no warnings "once"' line by repetitition (sic)

diff --git a/sbin/rt-email-dashboards.in b/sbin/rt-email-dashboards.in
index 89282a5..fccf339 100644
--- a/sbin/rt-email-dashboards.in
+++ b/sbin/rt-email-dashboards.in
@@ -98,8 +98,6 @@ require RT::Interface::Web::Handler;
 require RT::Dashboard;
 $HTML::Mason::Commands::r = RT::Dashboard::FakeRequest->new;
 
-no warnings 'once';
-
 # Read in the options
 my %opts;
 GetOptions( \%opts,
@@ -251,7 +249,11 @@ SUMMARY
         return;
     }
 
-    $HTML::Mason::Commands::session{CurrentUser} = $currentuser;
+    # Set the current user, while avoiding "used only once", without
+    # turning off warnings
+    $HTML::Mason::Commands::session{CurrentUser} =
+        $HTML::Mason::Commands::session{CurrentUser} = $currentuser;
+
     my $contents = run_component(
         '/Dashboards/Render.html',
         id      => $dashboard->Id,

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


More information about the Rt-commit mailing list