[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-214-g7aa4217

Alex Vandiver alexmv at bestpractical.com
Tue Aug 23 23:51:08 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  7aa42173314792376fb461c4ea54f60c967cb224 (commit)
       via  ec01796c82b4b56d003766f30872c35c409506b2 (commit)
       via  99fe0a3c558b5231b77b16617185cec5a90fed9f (commit)
      from  369d362977d6f8f01b5fc4dd2b309ee37241e2fb (commit)

Summary of changes:
 bin/rt.in                      |    4 ++--
 etc/RT_SiteConfig.pm           |    1 +
 lib/RT/Installer.pm            |    2 +-
 lib/RT/Shredder/Plugin/Base.pm |    2 +-
 lib/RT/Test.pm                 |    6 +++---
 sbin/extract-message-catalog   |    2 +-
 6 files changed, 9 insertions(+), 8 deletions(-)

- Log -----------------------------------------------------------------
commit 99fe0a3c558b5231b77b16617185cec5a90fed9f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Aug 23 22:55:11 2011 -0400

    Clarify logic of exclusive return statements

diff --git a/lib/RT/Shredder/Plugin/Base.pm b/lib/RT/Shredder/Plugin/Base.pm
index 7092203..a8882f6 100644
--- a/lib/RT/Shredder/Plugin/Base.pm
+++ b/lib/RT/Shredder/Plugin/Base.pm
@@ -126,7 +126,7 @@ sub HasSupportForArgs
         push @unsupported, $arg unless grep {$_ eq $arg} $self->SupportArgs;
     }
     return( 1 ) unless @unsupported;
-    return( 0, "Plugin doesn't support argument(s): @unsupported" ) if @unsupported;
+    return( 0, "Plugin doesn't support argument(s): @unsupported" );
 }
 
 =head3 TestArgs

commit ec01796c82b4b56d003766f30872c35c409506b2
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Aug 23 23:13:10 2011 -0400

    Check the return value of some recently-added close() calls

diff --git a/bin/rt.in b/bin/rt.in
index 7549941..c4c1819 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1202,7 +1202,7 @@ sub submit {
             my ($server, $user, $cookie) = split / /, $_;
             $sids->{$server}{$user} = $cookie;
         }
-        close $f;
+        close $f or return 0;
         return 1;
     }
 
@@ -1465,7 +1465,7 @@ sub parse_config_file {
             die "rt: $file:$.: unknown configuration directive.\n";
         }
     }
-    close $cfg;
+    close $cfg or return;
 
     return %cfg;
 }
diff --git a/lib/RT/Installer.pm b/lib/RT/Installer.pm
index 15835ca..8dc6bc4 100644
--- a/lib/RT/Installer.pm
+++ b/lib/RT/Installer.pm
@@ -282,7 +282,7 @@ sub SaveConfig {
         open( my $fh, '<', $file ) or die $!;
         $content = <$fh>;
         $content =~ s/^\s*1;\s*$//m;
-        close( $fh );
+        close( $fh ) or die $!;
     }
 
     # make organization the same as rtname
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 6b5a65c..807e7e3 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -277,7 +277,7 @@ sub bootstrap_logging {
     # make world writable so apache under different user
     # can write into it
     chmod 0666, $tmp{'log'}{'RT'};
-    close $fh;
+    close $fh or die "Can't close $tmp{'config'}{'RT'}: $!";
 
     print $config <<END;
 Set( \$LogToSyslog , undef);
@@ -1043,7 +1043,7 @@ sub start_apache_server {
             or Test::More::BAIL_OUT("Couldn't open pid file: $!");
         my $pid = <$pid_fh>;
         chomp $pid;
-        close $pid_fh;
+        close $pid_fh or Test::More::BAIL_OUT("Couldn't close pid file: $!");
         $pid;
     };
 
@@ -1216,7 +1216,7 @@ sub process_in_file {
             or die "couldn't open '$out_conf': $!";
     }
     print $out_fh $text;
-    close $out_fh;
+    close $out_fh or die "Couldn't close '$out_conf': $!";
 
     return 1;
 }
diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index f628449..13f63d8 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -260,7 +260,7 @@ sub update {
     my @lines;
     if (open my $lexicon_fh, '<', $file) {
         @lines = <$lexicon_fh>;
-        close $lexicon_fh;
+        close $lexicon_fh or die "Error reading $file: $!";
         @lines = grep { !/^(#(:|\.)\s*|$)/ } @lines;
     }
     while (@lines) {

commit 7aa42173314792376fb461c4ea54f60c967cb224
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Aug 23 23:47:51 2011 -0400

    Turn on warnings in the user SiteConfig

diff --git a/etc/RT_SiteConfig.pm b/etc/RT_SiteConfig.pm
index 1661e4d..6c52816 100755
--- a/etc/RT_SiteConfig.pm
+++ b/etc/RT_SiteConfig.pm
@@ -1,3 +1,4 @@
+use warnings;
 # Any configuration directives you include  here will override 
 # RT's default configuration file, RT_Config.pm
 #

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


More information about the Rt-commit mailing list