Permalink
Browse files

Perlop reminder, rewriting it

  • Loading branch information...
1 parent 7c28e50 commit eeaf561126a43fbfbd610a99e4d88726100f1264 @rgeissert committed Jan 23, 2012
Showing with 8 additions and 8 deletions.
  1. +8 −8 redir.pl
View
@@ -65,7 +65,7 @@
sub print_xtra($$);
sub find_arch($@);
sub clean_url($);
-sub consider_mirror($$);
+sub consider_mirror($);
$mirror_type = $q->param('mirror') || 'archive';
@@ -136,13 +136,13 @@
# match by AS
foreach my $match (@{$rdb->{'AS'}{$as}}) {
- $match_type ||= consider_mirror ($match, 'AS');
+ $match_type = 'AS' if (consider_mirror ($match));
}
# match by country
if (!$match_type) {
foreach my $match (keys %{$rdb->{'country'}{$geo_rec->country_code}}) {
- $match_type ||= consider_mirror ($match, 'country');
+ $match_type = 'country' if (consider_mirror ($match));
}
}
@@ -159,7 +159,7 @@
} else {
$mtype = 'nearby-continent';
}
- $match_type ||= consider_mirror ($match, $mtype);
+ $match_type = $mtype if (consider_mirror ($match));
}
}
}
@@ -288,15 +288,15 @@ ($)
return $url;
}
-sub consider_mirror($$) {
- my ($id, $match_type) = @_;
+sub consider_mirror($) {
+ my ($id) = @_;
my $mirror = $db->{'all'}{$id};
- return '' unless fullfils_request($db->{$mirror_type}, $id);
+ return 0 unless fullfils_request($db->{$mirror_type}, $id);
my $host = $mirror->{'site'}.$mirror->{$mirror_type.'-http'};
$hosts{$host} = calculate_distance($mirror->{'lon'}, $mirror->{'lat'},
$geo_rec->longitude, $geo_rec->latitude);
- return $match_type;
+ return 1;
}

0 comments on commit eeaf561

Please sign in to comment.