DDG/Meta/CountryCodes.pm

filter: Statementstmt 100% 36 / 36 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 97.4% 38 / 39 CC 1 SCAR 0.0
CC
1
Cov
97%
BEGIN
1.0
CRAP 1.0
« DDG/Block/Any.pm ↑ Summary DDG/Block/Blockable.pm »
1 package DDG::Meta::CountryCodes;
2 11 our $AUTHORITY = 'cpan:DDG';
3 # ABSTRACT: Master list of country renames and aliases for all IAs
4 11 $DDG::Meta::CountryCodes::VERSION = '1017';
5 11 ▶use Locale::Country 'country2code';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 ▶unless(country2code('DuckDuckGo')){
Branch: 1 branch
BranchTrueFalseTotal
unless (country2code("DuckDuckGo")) 11 0 11
8
9 # Add aliases
10 11 Locale::Country::add_country_alias('Antigua and Barbuda' => 'Antigua');
11 11 Locale::Country::add_country_alias('Antigua and Barbuda' => 'Barbuda');
12 11 Locale::Country::add_country_alias('Trinidad and Tobago' => 'Tobago');
13 11 Locale::Country::add_country_alias('Trinidad and Tobago' => 'Trinidad');
14 11 Locale::Country::add_country_alias('Vatican City' => 'Vatican');
15 11 Locale::Country::add_country_alias('Virgin Islands, U.S.' => 'US Virgin Islands');
16 11 Locale::Country::add_country_alias('United States' => 'America');
17
18 # Rename countries
19
20 # These are the only 2 countries which officially have 'The' in their name
21 # Source: http://www.bbc.co.uk/news/magazine-18233844
22 11 Locale::Country::rename_country('bs' => 'The Bahamas');
23 11 Locale::Country::rename_country('gm' => 'The Gambia');
24 11 Locale::Country::rename_country('ae' => 'the United Arab Emirates');
25 11 Locale::Country::rename_country('do' => 'the Dominican Republic');
26 11 Locale::Country::rename_country('gb' => 'the United Kingdom');
27 11 Locale::Country::rename_country('kp' => "the Democratic People's Republic of Korea"); # North Korea
28 11 Locale::Country::rename_country('kr' => 'the Republic of Korea'); # South Korea
29 11 Locale::Country::rename_country('ky' => 'the Cayman Islands');
30 11 Locale::Country::rename_country('mp' => 'the Northern Mariana Islands');
31 11 Locale::Country::rename_country('nl' => 'the Netherlands');
32 11 Locale::Country::rename_country('ph' => 'the Philippines');
33 11 Locale::Country::rename_country('ru' => 'the Russian Federation');
34 11 Locale::Country::rename_country('tw' => 'Taiwan');
35 11 Locale::Country::rename_country('us' => 'the United States');
36 11 Locale::Country::rename_country('va' => 'the Holy See (Vatican City State)');
37 11 Locale::Country::rename_country('vg' => 'the British Virgin Islands');
38 11 Locale::Country::rename_country('vi' => 'the US Virgin Islands');
39
40 # Easter eggs
41 11 Locale::Country::add_country_alias('Russian Federation' => 'Kremlin');
42 11 Locale::Country::add_country_alias('United States' => 'murica');
43 11 Locale::Country::add_country_alias('Canada' => 'Canadia');
44 11 Locale::Country::add_country_alias('Australia' => 'down under');
45 11 Locale::Country::add_country_alias('Canada' => 'DuckDuckGo');
46 }
47  
48 11 1;
49  
50 __END__
« DDG/Block/Any.pm ↑ Summary DDG/Block/Blockable.pm »