Permalink
Browse files

uncuddle elses

  • Loading branch information...
1 parent 48e7bdc commit ab50b2f4281de1137d7b4ff962070a2982846f0c @petdance committed Dec 22, 2012
Showing with 32 additions and 18 deletions.
  1. +6 −3 Ack.pm
  2. +4 −2 ConfigFinder.pm
  3. +5 −3 ConfigLoader.pm
  4. +3 −2 dev/find-minimum-dep-versions.pl
  5. +7 −4 t/Util.pm
  6. +3 −2 t/ack-invalid-ackrc.t
  7. +2 −1 t/ack-x.t
  8. +2 −1 t/mutex-options.t
View
9 Ack.pm
@@ -101,7 +101,8 @@ sub retrieve_arg_sources {
# XXX this is a potential race condition!
if(open my $fh, '<', $ackrc) {
close $fh;
- } else {
+ }
+ else {
die "Unable to load ackrc '$ackrc': $!"
}
push( @files, $ackrc );
@@ -1080,11 +1081,13 @@ sub get_file_id {
if ( $is_windows ) {
return File::Next::reslash( $filename );
- } else {
+ }
+ else {
# XXX is this the best method? it always hits the FS
if( my ( $dev, $inode ) = (stat($filename))[0, 1] ) {
return join(':', $dev, $inode);
- } else {
+ }
+ else {
# XXX this could be better
return $filename;
}
View
@@ -71,7 +71,8 @@ sub _remove_redundancies {
if( defined($dev) ) {
if( $dev_and_inode_seen{"$dev:$inode"} ) {
undef $path;
- } else {
+ }
+ else {
$dev_and_inode_seen{"$dev:$inode"} = 1;
}
}
@@ -108,7 +109,8 @@ sub find_config_files {
Win32::GetFolderPath(Win32::CSIDL_COMMON_APPDATA()),
Win32::GetFolderPath(Win32::CSIDL_APPDATA()),
);
- } else {
+ }
+ else {
push @config_files, '/etc/ackrc';
}
View
@@ -405,7 +405,8 @@ sub explode_sources {
# XXX refactor?
if ( $arg =~ /(\w+)=/) {
$arg_spec->{$1} = sub {};
- } else {
+ }
+ else {
( $arg ) = split /:/, $arg;
$arg_spec->{$arg} = sub {};
}
@@ -513,11 +514,12 @@ sub remove_default_options_if_needed {
my ( $name, $args ) = @{$sources}[ $index, $index + 1 ];
- if(ref($args)) {
+ if (ref($args)) {
Getopt::Long::GetOptionsFromArray($args,
'ignore-ack-defaults' => \$should_remove,
);
- } else {
+ }
+ else {
( undef, $sources->[$index + 1] ) = Getopt::Long::GetOptionsFromString($args,
'ignore-ack-defaults' => \$should_remove,
);
@@ -92,10 +92,11 @@ (&@)
local $_ = $values[$middle];
my $result = $predicate->($_);
- if($result) {
+ if ($result) {
$last_good = $_;
$high = $middle - 1;
- } else {
+ }
+ else {
$low = $middle + 1;
}
}
View
@@ -386,7 +386,8 @@ sub record_option_coverage {
$command_line = "$^X $record_options $command_line";
system $command_line;
- } else {
+ }
+ else {
while ( @command_line && $command_line[0] !~ /ack/ ) {
shift @command_line;
}
@@ -405,7 +406,7 @@ BEGIN {
1;
};
- if($ok) {
+ if ($ok) {
no strict 'refs';
*run_ack_interactive = sub {
my ( @args) = @_;
@@ -432,7 +433,8 @@ BEGIN {
close $pty;
waitpid $pid, 0;
return @lines;
- } else {
+ }
+ else {
my $output = '';
while(<$pty>) {
@@ -442,7 +444,8 @@ BEGIN {
waitpid $pid, 0;
return $output;
}
- } else {
+ }
+ else {
$pty->make_slave_controlling_terminal();
my $slave = $pty->slave();
$slave->clone_winsize_from(\*STDIN);
View
@@ -42,7 +42,7 @@ like $output, qr/Usage: ack/;
like $stderr, qr/Unknown option: frobnicate/;
# the following was shamelessly copied from ack-help-types.t
- for(my $i = 0; $i < @types; $i += 2) {
+ for (my $i = 0; $i < @types; $i += 2) {
my ( $type, $checks ) = @types[ $i , $i + 1 ];
my ( $matching_line ) = grep { /--\[no\]$type/ } @{$output};
@@ -68,7 +68,8 @@ like $output, qr/Usage: ack/;
if (is_win32()) {
like join("\n", @{$output}[0,1]), qr/^NAME\s+ack(?:-standalone)?\s/;
- } else {
+ }
+ else {
like $output->[0], qr/ACK(?:-STANDALONE)?\Q(1)\E/;
}
}
View
@@ -106,7 +106,8 @@ my ($stdout, $stderr);
if (is_win32()) {
($stdout, $stderr) = run_cmd("@lhs_args | @rhs_args");
-} else {
+}
+else {
my ( $stdout_read, $stdout_write );
my ( $stderr_read, $stderr_write );
my ( $lhs_rhs_read, $lhs_rhs_write );
View
@@ -27,7 +27,8 @@ sub are_mutually_exclusive {
$error =~ /Options '$opt2_re' and '$opt1_re' are mutually exclusive/) {
pass qq{Error message resembles "Options '$opt1' and '$opt2' are mutually exclusive"};
- } else {
+ }
+ else {
fail qq{Error message does not resemble "Options '$opt1' and '$opt2' are mutually exclusive"};
diag("Error message: '$error'");
}

0 comments on commit ab50b2f

Please sign in to comment.