File Coverage

blib/lib/Country/Codes.pm
Criterion Covered Total %
statement 9 12 75.0
branch n/a
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 17 70.5


line stmt bran cond sub pod time code
1             # Country::Codes.pm
2             # Countries to be used for decoding to the full name of a country.
3             # Jason C. Rochon
4             # 01/29/2014
5            
6             package Country::Codes;
7 1     1   45519 use strict;
  1         2  
  1         43  
8 1     1   6 use warnings;
  1         2  
  1         59  
9            
10             our (@ISA, @EXPORT, $VERSION);
11            
12 1     1   5 use Exporter;
  1         7  
  1         991  
13             $VERSION = 1.01;
14             @ISA = qw(Exporter);
15            
16             @EXPORT = qw(country);
17            
18             sub country
19             {
20 0     0 0   my $ans = uc shift;
21            
22 0           our %codes = ("US" => "United States",
23             "AF" => "Afghanistan",
24             "AL" => "Albania",
25             "DZ" => "Algeria",
26             "AS" => "American Samoa",
27             "AD" => "Andorra",
28             "AO" => "Angola",
29             "AI" => "Anguilla",
30             "AQ" => "Antarctica",
31             "AG" => "Antigua and Barbuda",
32             "AR" => "Argentina",
33             "AM" => "Armenia",
34             "AW" => "Aruba",
35             "AU" => "Australia",
36             "AT" => "Austria",
37             "AZ" => "Azerbaijan",
38             "BS" => "Bahamas",
39             "BH" => "Bahrain",
40             "BD" => "Bangladesh",
41             "BB" => "Barbados",
42             "BY" => "Belarus",
43             "BE" => "Belgium",
44             "BZ" => "Belize",
45             "BJ" => "Benin",
46             "BM" => "Bermuda",
47             "BT" => "Bhutan",
48             "BO" => "Bolivia",
49             "BA" => "Bosnia and Herzegovina",
50             "BW" => "Botswana",
51             "BV" => "Bouvet Island",
52             "BR" => "Brazil",
53             "IO" => "British Indian Ocean Territory",
54             "BN" => "Brunei Darussalam",
55             "BG" => "Bulgaria",
56             "BF" => "Burkina Faso",
57             "BI" => "Burundi",
58             "KH" => "Cambodia",
59             "CM" => "Cameroon",
60             "CA" => "Canada",
61             "CV" => "Cape Verde",
62             "KY" => "Cayman Islands",
63             "CF" => "Central African Republic",
64             "TD" => "Chad",
65             "CL" => "Chile",
66             "CN" => "China",
67             "CX" => "Christmas Island",
68             "CC" => "Cocos (Keeling) Islands",
69             "CO" => "Colombia",
70             "KM" => "Comoros",
71             "CD" => "Congo, the Democratic Republic of the",
72             "CG" => "Congo",
73             "CK" => "Cook Islands",
74             "CR" => "Costa Rica",
75             "CI" => "Cote d'Ivoire",
76             "HR" => "Croatia",
77             "CU" => "Cuba",
78             "CY" => "Cyprus",
79             "CZ" => "Czech Republic",
80             "DK" => "Denmark",
81             "DJ" => "Djibouti",
82             "DM" => "Dominica",
83             "DO" => "Dominican Republic",
84             "EC" => "Ecuador",
85             "EG" => "Egypt",
86             "SV" => "El Salvador",
87             "GQ" => "Equatorial Guinea",
88             "ER" => "Eritrea",
89             "EE" => "Estonia",
90             "ET" => "Ethiopia",
91             "FK" => "Falkland Islands (Malvinas)",
92             "FO" => "Faroe Islands",
93             "FJ" => "Fiji",
94             "FI" => "Finland",
95             "FR" => "France",
96             "GF" => "French Guiana",
97             "PF" => "French Polynesia",
98             "TF" => "French Southern Territories",
99             "GA" => "Gabon",
100             "GM" => "Gambia",
101             "GE" => "Georgia",
102             "DE" => "Germany",
103             "GH" => "Ghana",
104             "GI" => "Gibraltar",
105             "GR" => "Greece",
106             "GL" => "Greenland",
107             "GD" => "Grenada",
108             "GP" => "Guadeloupe",
109             "GU" => "Guam",
110             "GT" => "Guatemala",
111             "GG" => "Guernsey",
112             "GW" => "Guinea-Bissau",
113             "GN" => "Guinea",
114             "GY" => "Guyana",
115             "HT" => "Haiti",
116             "HM" => "Heard Island and McDonald Islands",
117             "VA" => "Holy See (Vatican City State)",
118             "HN" => "Honduras",
119             "HK" => "Hong Kong",
120             "HU" => "Hungary",
121             "IS" => "Iceland",
122             "IN" => "India",
123             "ID" => "Indonesia",
124             "IR" => "Iran, Islamic Republic of",
125             "IQ" => "Iraq",
126             "IE" => "Ireland",
127             "IM" => "Isle of Man",
128             "IL" => "Israel",
129             "IT" => "Italy",
130             "JM" => "Jamaica",
131             "JC" => "Jason C. Rochon",
132             "JP" => "Japan",
133             "JE" => "Jersey",
134             "JO" => "Jordan",
135             "KZ" => "Kazakhstan",
136             "KE" => "Kenya",
137             "KI" => "Kiribati",
138             "KP" => "Korea, Democratic People's Republic of",
139             "KR" => "Korea, Republic of",
140             "KW" => "Kuwait",
141             "KG" => "Kyrgyzstan",
142             "LA" => "Lao People's Democratic Republic",
143             "LV" => "Latvia",
144             "LB" => "Lebanon",
145             "LS" => "Lesotho",
146             "LR" => "Liberia",
147             "LY" => "Libyan Arab Jamahiriya",
148             "LI" => "Liechtenstein",
149             "LT" => "Lithuania",
150             "LU" => "Luxembourg",
151             "MO" => "Macao",
152             "MK" => "Macedonia, the former Yugoslav Republic of",
153             "MG" => "Madagascar",
154             "MW" => "Malawi",
155             "MY" => "Malaysia",
156             "MV" => "Maldives",
157             "ML" => "Mali",
158             "MT" => "Malta",
159             "MH" => "Marshall Islands",
160             "MQ" => "Martinique",
161             "MR" => "Mauritania",
162             "MU" => "Mauritius",
163             "YT" => "Mayotte",
164             "MX" => "Mexico",
165             "FM" => "Micronesia, Federated States of",
166             "MD" => "Moldova, Republic of",
167             "MC" => "Monaco",
168             "MN" => "Mongolia",
169             "ME" => "Montenegro",
170             "MS" => "Montserrat",
171             "MA" => "Morocco",
172             "MZ" => "Mozambique",
173             "MM" => "Myanmar",
174             "NA" => "Namibia",
175             "NR" => "Nauru",
176             "NP" => "Nepal",
177             "AN" => "Netherlands Antilles",
178             "NL" => "Netherlands",
179             "NC" => "New Caledonia",
180             "NZ" => "New Zealand",
181             "NI" => "Nicaragua",
182             "NE" => "Niger",
183             "NG" => "Nigeria",
184             "NU" => "Niue",
185             "NF" => "Norfolk Island",
186             "MP" => "Northern Mariana Islands",
187             "NO" => "Norway",
188             "OM" => "Oman",
189             "PK" => "Pakistan",
190             "PW" => "Palau",
191             "PS" => "Palestinian Territory, Occupied",
192             "PA" => "Panama",
193             "PG" => "Papua New Guinea",
194             "PY" => "Paraguay",
195             "PE" => "Peru",
196             "PH" => "Philippines",
197             "PN" => "Pitcairn",
198             "PL" => "Poland",
199             "PT" => "Portugal",
200             "PR" => "Puerto Rico",
201             "QA" => "Qatar",
202             "RE" => "Reunion",
203             "RO" => "Romania",
204             "RU" => "Russian Federation",
205             "RW" => "Rwanda",
206             "BL" => "Saint Barthelemy",
207             "SH" => "Saint Helena",
208             "KN" => "Saint Kitts and Nevis",
209             "LC" => "Saint Lucia",
210             "MF" => "Saint Martin (French part)",
211             "PM" => "Saint Pierre and Miquelon",
212             "VC" => "Saint Vincent and the Grenadines",
213             "WS" => "Samoa",
214             "SM" => "San Marino",
215             "ST" => "Sao Tome and Principe",
216             "SA" => "Saudi Arabia",
217             "SN" => "Senegal",
218             "RS" => "Serbia",
219             "SC" => "Seychelles",
220             "SL" => "Sierra Leone",
221             "SG" => "Singapore",
222             "SK" => "Slovakia",
223             "SI" => "Slovenia",
224             "SB" => "Solomon Islands",
225             "SO" => "Somalia",
226             "ZA" => "South Africa",
227             "GS" => "South Georgia and the South Sandwich Islands",
228             "ES" => "Spain",
229             "LK" => "Sri Lanka",
230             "SD" => "Sudan",
231             "SR" => "Suriname",
232             "SJ" => "Svalbard and Jan Mayen",
233             "SZ" => "Swaziland",
234             "SE" => "Sweden",
235             "CH" => "Switzerland",
236             "SY" => "Syrian Arab Republic",
237             "TW" => "Taiwan, Province of China",
238             "TJ" => "Tajikistan",
239             "TZ" => "Tanzania, United Republic of",
240             "TH" => "Thailand",
241             "TL" => "Timor-Leste",
242             "TG" => "Togo",
243             "TK" => "Tokelau",
244             "TO" => "Tonga",
245             "TT" => "Trinidad and Tobago",
246             "TN" => "Tunisia",
247             "TR" => "Turkey",
248             "TM" => "Turkmenistan",
249             "TC" => "Turks and Caicos Islands",
250             "TV" => "Tuvalu",
251             "UG" => "Uganda",
252             "UA" => "Ukraine",
253             "AE" => "United Arab Emirates",
254             "GB" => "United Kingdom",
255             "UM" => "United States Minor Outlying Islands",
256             "US" => "United States",
257             "UY" => "Uruguay",
258             "UZ" => "Uzbekistan",
259             "VU" => "Vanuatu",
260             "VE" => "Venezuela",
261             "VN" => "Viet Nam",
262             "VG" => "Virgin Islands, British",
263             "VI" => "Virgin Islands, U.S.",
264             "WF" => "Wallis and Futuna",
265             "EH" => "Western Sahara",
266             "YE" => "Yemen",
267             "ZM" => "Zambia",
268             "ZW" => "Zimbabwe"
269             );
270            
271 0           return $codes{$ans};
272             }
273            
274             1;
275            
276             __END__