if (-f "pingdom.yml")
{
- $cache = YAML::LoadFile("pingdom.yml");
+ $cache = YAML::LoadFile("pingdom.yml");
}
else
{
my $jsonfile = IO::File->new("> json/${zone}.json") || die "$!";
# Output details for each country
-foreach my $origin (values %$origins)
+foreach my $origin (sort { $a->{name} cmp $b->{name} } values %$origins)
{
my $cluster = $origin->{cluster};
my $clon = $origin->{lon};
$zonefile->print("# Unknown origins\n");
# Output default records for IPs that can't be mapped to a country
-while (my($name,$cluster) = each %$clusters)
+foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters)
{
+ my $name = $cluster->{name};
+
if (my $default = $cluster->{default})
{
output_server($zonefile, "${default}.${zone}", $cluster);
$zonefile->print("# Servers\n");
# Output A records for each cluster
-while (my($name,$cluster) = each %$clusters)
+foreach my $cluster (sort { $a->{name} cmp $b->{name} } values %$clusters)
{
+ my $name = $cluster->{name};
+
output_server($zonefile, "${name}.${zone}", $cluster);
}