Skip Menu |

This queue is for tickets about the Locale-SubCountry CPAN distribution.

Report information
The Basics
Id: 67747
Status: resolved
Priority: 0/
Queue: Locale-SubCountry

People
Owner: kimryan [...] cpan.org
Requestors: olaf [...] wundersolutions.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.46
Fixed in: (no value)



Hi Kim, When creating objects with a country code, no subcountries are found. This is due to one missing sigil. Patch (and some coverage tests) provided. Best, Olaf
Subject: 0001-Adds-missing-sigil-which-was-causing-errors-when-cre.patch
From 370acf1f9d174097453a8f28f730ce722ff88352 Mon Sep 17 00:00:00 2001 From: Olaf Alders <olaf@wundersolutions.com> Date: Mon, 25 Apr 2011 14:10:29 -0400 Subject: [PATCH] Adds missing sigil, which was causing errors when creating objects via a country code. --- lib/Locale/SubCountry.pm | 2 +- t/main.t | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/lib/Locale/SubCountry.pm b/lib/Locale/SubCountry.pm index bc6c64c..ecaee92 100644 --- a/lib/Locale/SubCountry.pm +++ b/lib/Locale/SubCountry.pm @@ -531,7 +531,7 @@ sub new { $country_code = $country_or_code; # set country to it's full name - $country = $Locale::SubCountry::country_lookup{_code_keyed}{country_code}; + $country = $Locale::SubCountry::country_lookup{_code_keyed}{$country_code}; } else { diff --git a/t/main.t b/t/main.t index faaaa35..cabd6a0 100644 --- a/t/main.t +++ b/t/main.t @@ -7,6 +7,7 @@ use strict; use locale; use Locale::SubCountry; +use Test::More; # We start with some black magic to print on failure. @@ -57,5 +58,14 @@ print $australia->code('Old South Wales ') eq 'unknown' ? "ok 16\n" : "not ok 16 print $australia->full_name('XYZ') eq 'unknown' ? "ok 17\n" : "not ok 17\n"; +use Data::Dump qw( dump ); +foreach my $code ( @all_country_codes ) { + my $entity = new Locale::SubCountry ( $code ); + ok ( $entity, "got object for $code" ); + my %codes = $entity->code_full_name_hash; + ok( %codes, "got some codes for $code" ); + diag dump \%codes; +} +done_testing(); -- 1.7.4.4
Fixed in 1.47