On 10/23/06, Dave Rolsky <[EMAIL PROTECTED]> wrote:
0.52     2006-10-22

- The names_in_country() method no longer sorts the zone
  names. Instead, it returns them in order from most- to
  least-populated.

In 0.55 it's still sorted by names.

% perl -MDateTime::TimeZone -le 'print $DateTime::TimeZone::VERSION;
print [ DateTime::TimeZone->names_in_country("us") ]->[0]'
0.55
America/Adak

In 0.52 you removed the sort() in the wrong place. Here's a patch and
an unit test against 0.55.

=== t/15catalog.t
==================================================================
--- t/15catalog.t       (revision 5779)
+++ t/15catalog.t       (local)
@@ -8,7 +8,7 @@
use DateTime::TimeZoneCatalog;


-plan tests => 29;
+plan tests => 30;

{
    my @all = DateTime::TimeZone::all_names();
@@ -100,3 +100,10 @@
               [ 'America/Santiago', 'Pacific/Easter' ],
               'zones for Chile are America/Santiago and Pacific/Easter' );
}
+
+{
+    my @zones = DateTime::TimeZone::names_in_country('us');
+    is( $zones[0], 'America/New_York', 'I <3 New York' );
+}
+
+
=== tools/parse_olson
==================================================================
--- tools/parse_olson   (revision 5779)
+++ tools/parse_olson   (local)
@@ -431,12 +431,12 @@
    $countries{UK} = $countries{GB};

    my $countries = '';
-    # We explicitly do not sort these because the order in zones.tab
-    # is by population.
-    for my $c ( keys %countries )
+    for my $c ( sort keys %countries )
    {
        $countries .= qq|  '\L$c' => [ qw(\n|;
-        $countries .= join "\n", map { "    $_" } sort @{ $countries{$c} };
+        # We explicitly do not sort these because the order in zones.tab
+        # is by population.
+        $countries .= join "\n", map { "    $_" } @{ $countries{$c} };
        $countries .= "\n) ],\n";
    }


--
Tatsuhiko Miyagawa

Reply via email to