[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-201-g0f6db71
Alex Vandiver
alexmv at bestpractical.com
Wed Aug 17 18:07:23 EDT 2011
The branch, 3.8/perlcritic has been updated
via 0f6db7130b5b3dd78115aa84195dc99aa353e109 (commit)
via 872ff68d3d3f9dbb8c6f516bf3d5e67cf205ec9b (commit)
via 67c2bc62409480fb927f94ad10b4b4c8691859bf (commit)
from eaeb27cdada11fde8450586f2521c38301b88c30 (commit)
Summary of changes:
bin/rt.in | 22 +++++++++++++---------
etc/RT_Config.pm.in | 1 -
lib/RT/Installer.pm | 1 +
lib/RT/Interface/CLI.pm | 6 +++---
lib/RT/Test.pm | 14 +++++---------
sbin/extract-message-catalog | 8 +++++---
6 files changed, 27 insertions(+), 25 deletions(-)
- Log -----------------------------------------------------------------
commit 67c2bc62409480fb927f94ad10b4b4c8691859bf
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Fri Aug 12 16:57:04 2011 -0400
The package line is now unnecessary, given how RT::Config works in 3.8
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 9a72acd..f938a7a 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1,4 +1,3 @@
-package RT;
use warnings;
=head1 NAME
commit 872ff68d3d3f9dbb8c6f516bf3d5e67cf205ec9b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Aug 16 17:23:49 2011 -0400
Make scalar slurping of <DATA> clearer
diff --git a/bin/rt.in b/bin/rt.in
index 715f631..5c27258 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -213,8 +213,8 @@ sub help {
# What help topics do we know about?
if (!%help) {
- local $/ = undef;
- foreach my $item (@{ Form::parse(<DATA>) }) {
+ my $help = do { local $/ = undef; <DATA> };
+ foreach my $item (@{ Form::parse( $help ) }) {
my $titleref = $item->[2]{Title};
my @titles = ref $titleref eq 'ARRAY' ? @$titleref : $titleref;
commit 0f6db7130b5b3dd78115aa84195dc99aa353e109
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Aug 17 17:49:24 2011 -0400
Scope some filehandles more tightly
diff --git a/bin/rt.in b/bin/rt.in
index 5c27258..1f6a2a7 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1201,6 +1201,7 @@ sub submit {
my ($server, $user, $cookie) = split / /, $_;
$sids->{$server}{$user} = $cookie;
}
+ close $f;
return 1;
}
@@ -1463,6 +1464,7 @@ sub parse_config_file {
die "rt: $file:$.: unknown configuration directive.\n";
}
}
+ close $cfg;
return %cfg;
}
@@ -1499,15 +1501,17 @@ sub vi {
my $editor = $ENV{EDITOR} || $ENV{VISUAL} || "vi";
local $/ = undef;
- my $f;
- open($f, '>', $file) or die "Can't write $file: $!\n";
- print $f $text;
- close($f) or die "Failed to close $file: $!";
+ open(my $write, '>', $file) or die "Can't write $file: $!\n";
+ print $write $text;
+ close($write) or die "Failed to close $file: $!";
+
system($editor, $file) && die "Couldn't run $editor.\n";
- open($f, '<', $file) or die "Can't read $file: $!\n";
- $text = <$f>;
- close($f) or die "Failed to close $file: $!";
+
+ open(my $read, '<', $file) or die "Can't read $file: $!\n";
+ $text = <$read>;
+ close($read) or die "Failed to close $file: $!";
+
unlink($file);
return $text;
diff --git a/lib/RT/Installer.pm b/lib/RT/Installer.pm
index 6eb3276..15835ca 100644
--- a/lib/RT/Installer.pm
+++ b/lib/RT/Installer.pm
@@ -282,6 +282,7 @@ sub SaveConfig {
open( my $fh, '<', $file ) or die $!;
$content = <$fh>;
$content =~ s/^\s*1;\s*$//m;
+ close( $fh );
}
# make organization the same as rtname
diff --git a/lib/RT/Interface/CLI.pm b/lib/RT/Interface/CLI.pm
index 5a24497..bfd5036 100755
--- a/lib/RT/Interface/CLI.pm
+++ b/lib/RT/Interface/CLI.pm
@@ -227,9 +227,9 @@ sub GetMessageContent {
system ($ENV{'EDITOR'}, $filename);
}
- open( $fh, '<', $filename ) or die $!;
- my @newlines = (<$fh>);
- close ($fh) or die $!;
+ open( my $read, '<', $filename ) or die $!;
+ my @newlines = (<$read>);
+ close ($read) or die $!;
unlink ($filename) unless (debug());
return(\@newlines);
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 6e3fbe2..266d47c 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -262,7 +262,7 @@ END
$ENV{'RT_SITE_CONFIG'} = $tmp{'config'}{'RT'};
close $config or die "Failed to write $tmp{config}{RT}: $!";
- return $config;
+ return 1;
}
sub bootstrap_logging {
@@ -278,6 +278,7 @@ sub bootstrap_logging {
# make world writable so apache under different user
# can write into it
chmod 0666, $tmp{'log'}{'RT'};
+ close $fh;
print $config <<END;
Set( \$LogToSyslog , undef);
@@ -998,12 +999,6 @@ sub start_apache_server {
my %info = $self->apache_server_info( variant => $variant );
- Test::More::diag(do {
- open( my $fh, '<', $tmp{'config'}{'RT'} ) or die $!;
- local $/ = undef;
- <$fh>
- });
-
my $tmpl = File::Spec->rel2abs( File::Spec->catfile(
't', 'data', 'configs',
'apache'. $info{'version'} .'+'. $variant .'.conf'
@@ -1049,6 +1044,7 @@ sub start_apache_server {
or Test::More::BAIL_OUT("Couldn't open pid file: $!");
my $pid = <$pid_fh>;
chomp $pid;
+ close $pid_fh;
$pid;
};
@@ -1221,9 +1217,9 @@ sub process_in_file {
or die "couldn't open '$out_conf': $!";
}
print $out_fh $text;
- seek $out_fh, 0, 0;
+ close $out_fh;
- return ($out_fh, $out_conf);
+ return 1;
}
sub parse_mail {
diff --git a/sbin/extract-message-catalog b/sbin/extract-message-catalog
index 8abffe7..9b3e64b 100755
--- a/sbin/extract-message-catalog
+++ b/sbin/extract-message-catalog
@@ -258,9 +258,11 @@ sub update {
print "Updating $lang...\n";
my @lines;
- my $lexicon_fh;
- @lines = (<$lexicon_fh>) if open $lexicon_fh, '<', $file;
- @lines = grep { !/^(#(:|\.)\s*|$)/ } @lines;
+ if (open my $lexicon_fh, '<', $file) {
+ @lines = <$lexicon_fh>;
+ close $lexicon_fh;
+ @lines = grep { !/^(#(:|\.)\s*|$)/ } @lines;
+ }
while (@lines) {
my $msghdr = "";
$msghdr .= shift @lines while ( $lines[0] && $lines[0] !~ /^(#~ )?msgid/ );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list