[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-63-g3e34513
Alex Vandiver
alexmv at bestpractical.com
Thu Jul 21 14:42:44 EDT 2011
The branch, 3.8/perlcritic has been updated
via 3e34513495fa06c5b9e87823de05598b7f301b5a (commit)
from feb22e93a7771e0b07b32ee385fe41fb799e70b0 (commit)
Summary of changes:
bin/rt.in | 69 +++++++++++++++++++++++++-----------------------------
lib/RT/Handle.pm | 4 +-
2 files changed, 34 insertions(+), 39 deletions(-)
- Log -----------------------------------------------------------------
commit 3e34513495fa06c5b9e87823de05598b7f301b5a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Jul 21 14:22:12 2011 -0400
Change to the more canonical "open(...) or ..." idiom
diff --git a/bin/rt.in b/bin/rt.in
index a85c27a..1ec63cd 100755
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1184,19 +1184,17 @@ sub submit {
$file ||= $self->{file};
my $f;
- open($f, '<', $file) && do {
- $self->{file} = $file;
- my $sids = $self->{sids} = {};
- while (<$f>) {
- chomp;
- next if /^$/ || /^#/;
- next unless m#^https?://[^ ]+ \w+ [^;,\s]+=[0-9A-Fa-f]+$#;
- my ($server, $user, $cookie) = split / /, $_;
- $sids->{$server}{$user} = $cookie;
- }
- return 1;
- };
- return 0;
+ open($f, '<', $file) or return 0;
+ $self->{file} = $file;
+ my $sids = $self->{sids} = {};
+ while (<$f>) {
+ chomp;
+ next if /^$/ || /^#/;
+ next unless m#^https?://[^ ]+ \w+ [^;,\s]+=[0-9A-Fa-f]+$#;
+ my ($server, $user, $cookie) = split / /, $_;
+ $sids->{$server}{$user} = $cookie;
+ }
+ return 1;
}
# Writes the current session cache to the specified file.
@@ -1205,21 +1203,19 @@ sub submit {
$file ||= $self->{file};
my $f;
- open($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";
- }
+ open($f, '>', $file) or return 0;
+ 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";
}
}
- close($f);
- chmod 0600, $file;
- return 1;
- };
- return 0;
+ }
+ close($f);
+ chmod 0600, $file;
+ return 1;
}
sub DESTROY {
@@ -1448,19 +1444,18 @@ sub parse_config_file {
local $_; # $_ may be aliased to a constant, from line 1163
my $cfg;
- open($cfg, '<', $file) && do {
- while (<$cfg>) {
- chomp;
- next if (/^#/ || /^\s*$/);
+ open($cfg, '<', $file) or return;
+ while (<$cfg>) {
+ chomp;
+ next if (/^#/ || /^\s*$/);
- if (/^(externalauth|user|passwd|server|query|orderby|queue)\s+(.*)\s?$/) {
- $cfg{$1} = $2;
- }
- else {
- die "rt: $file:$.: unknown configuration directive.\n";
- }
+ if (/^(externalauth|user|passwd|server|query|orderby|queue)\s+(.*)\s?$/) {
+ $cfg{$1} = $2;
+ }
+ else {
+ die "rt: $file:$.: unknown configuration directive.\n";
}
- };
+ }
return %cfg;
}
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 500adbe..ccba4b2 100755
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -477,9 +477,9 @@ sub InsertSchema {
open( my $fh_schema, '<', $file ) or die $!;
- my $has_local = 0;
+ my $has_local = 1;
open( my $fh_schema_local, "<", $self->GetVersionFile( $dbh, $RT::LocalEtcPath . "/schema." . $db_type ))
- and $has_local = 1;
+ or $has_local = 0;
my $statement = "";
foreach my $line ( <$fh_schema>, ($_ = ';;'), $has_local? <$fh_schema_local>: () ) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list