in reply to Warning will not supresss
The entry for the Shariff Kabunsuan region of the PHILIPPINES does not have a code. Apparently the ISO 3166.2 codes do not reflect recent changes in Philipino government structure.
Since the data set is accurate, one must then conclude that the code that parses the data set is in error. The code makes the assumption that any 'subcountry' will have both a 'name' and a 'code'.
I think the right thing to do is to patch the parsing logic to match the current coding style. The warning is correct, there is a problem with the code.
Submit a bug report and possibly a patch to the author.
I've made a feeble stab at fixing the code, but I don't know enough about localization standards to know if my implementation is correct.
Here is the relevant section of the original code, from around line 439:
# Insert into doubly indexed hash, grouped by country for ISO 3166-2 # codes. One hash is keyed by abbreviation and one by full name. Altho +ugh # data is duplicated, this provides the fastest lookup and simplest co +de. $::subcountry_lookup{$country_name}{_code_keyed}{$sub_country_code} = +$sub_country_name; $::subcountry_lookup{$country_name}{_full_name_keyed}{$sub_country_nam +e} = $sub_country_code; if ( $category ) { $::subcountry_lookup{$country_name}{$sub_country_code}{_category} += $category; } if ( $regional_division ) { $::subcountry_lookup{$country_name}{$sub_country_code}{_regional_d +ivision} = $regional_division; } if ( $FIPS_code ) { # Insert into doubly indexed hash, grouped by country for FIPS 10- +4 codes $::subcountry_lookup{$country_name}{_FIPS10_4_code_keyed}{$FIPS_co +de} = $sub_country_code; $::subcountry_lookup{$country_name}{_ISO3166_2_code_keyed}{$sub_co +untry_code} = $FIPS_code; }
Here are my untested modifications:
# Insert into doubly indexed hash, grouped by country for ISO 3166-2 # codes. One hash is keyed by abbreviation and one by full name. Altho +ugh # data is duplicated, this provides the fastest lookup and simplest co +de. $::subcountry_lookup{$country_name}{_full_name_keyed}{$sub_country_nam +e} = $sub_country_code || 'UNDEFINED'; # These items all depend on a sub_country_code being set. if ( $sub_country_code ) { $::subcountry_lookup{$country_name}{_code_keyed}{$sub_country_code +} = $sub_country_name; if ( $category ) { $::subcountry_lookup{$country_name}{$sub_country_code}{_catego +ry} = $category; } if ( $regional_division ) { $::subcountry_lookup{$country_name}{$sub_country_code}{_region +al_division} = $regional_division; } if ( $FIPS_code ) { # Insert into doubly indexed hash, grouped by country for FIPS + 10-4 codes $::subcountry_lookup{$country_name}{_FIPS10_4_code_keyed}{$FIP +S_code} = $sub_country_code; $::subcountry_lookup{$country_name}{_ISO3166_2_code_keyed}{$su +b_country_code} = $FIPS_code; } }
TGI says moo
|
|---|