| 1 | package Net::Domain::ES::ccTLD; | ||||||||||||
| 2 | |||||||||||||
| 3 | 4 | ▶ | use utf8; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | ▶ | use Modern::Perl; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 4 | ▶ | use Carp qw( croak ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 4 | ▶ | use base qw/Exporter/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 4 | our @EXPORT = qw/find_name_by_cctld/; | |||||||||||
| 9 | |||||||||||||
| 10 | =head1 NAME | ||||||||||||
| 11 | |||||||||||||
| 12 | Net::Domain::ES::ccTLD - Lookup for country names given the TLD code (¡en Español!) | ||||||||||||
| 13 | |||||||||||||
| 14 | =head1 VERSION | ||||||||||||
| 15 | |||||||||||||
| 16 | Version 0.01. ¡Se habla Español! | ||||||||||||
| 17 | |||||||||||||
| 18 | =cut | ||||||||||||
| 19 | |||||||||||||
| 20 | 4 | our $VERSION = '0.05'; | |||||||||||
| 21 | |||||||||||||
| 22 | =head1 SYNOPSIS | ||||||||||||
| 23 | |||||||||||||
| 24 | Lookup for a country name given the country code (ccTLD)... in Spanish. | ||||||||||||
| 25 | |||||||||||||
| 26 | use Net::Domain::ES::ccTLD; | ||||||||||||
| 27 | |||||||||||||
| 28 | my $country = find_name_by_cctld('mx') # $country is 'México' | ||||||||||||
| 29 | or die "Couldn't find name."; | ||||||||||||
| 30 | |||||||||||||
| 31 | my $neighbor = find_name_by_cctld('us'); # $neighbor is 'Estados Unidos' | ||||||||||||
| 32 | |||||||||||||
| 33 | =head1 EXPORT | ||||||||||||
| 34 | |||||||||||||
| 35 | =head2 find_name_by_cctld | ||||||||||||
| 36 | |||||||||||||
| 37 | It returns the Spanish name of the country code or undef if it can't find it. | ||||||||||||
| 38 | |||||||||||||
| 39 | =head1 DESCRIPTION | ||||||||||||
| 40 | |||||||||||||
| 41 | This module is similar to L<Locales::Country::es> in purpose, but this one does work | ||||||||||||
| 42 | (I tried that one and it was busted), I actively maintain it (because I use it for | ||||||||||||
| 43 | my work), the encoding is not messed up and it's based on the names under: | ||||||||||||
| 44 | |||||||||||||
| 45 | http://es.wikipedia.org/wiki/Dominio_de_nivel_superior_geogr%C3%A1fico | ||||||||||||
| 46 | |||||||||||||
| 47 | You've been warned :) | ||||||||||||
| 48 | |||||||||||||
| 49 | =cut | ||||||||||||
| 50 | |||||||||||||
| 51 | 4 | my %_cc_map = ( | |||||||||||
| 52 | ad => 'Andorra', | ||||||||||||
| 53 | ae => 'Emiratos Árabes Unidos', | ||||||||||||
| 54 | af => 'Afganistán', | ||||||||||||
| 55 | ag => 'Antigua y Barbuda', | ||||||||||||
| 56 | ai => 'Anguila', | ||||||||||||
| 57 | al => 'Albania', | ||||||||||||
| 58 | am => 'Armenia', | ||||||||||||
| 59 | an => 'Antillas Neerlandesas', | ||||||||||||
| 60 | ao => 'Angola', | ||||||||||||
| 61 | aq => 'Antártida', | ||||||||||||
| 62 | ar => 'Argentina', | ||||||||||||
| 63 | as => 'Samoa Americana', | ||||||||||||
| 64 | at => 'Austria', | ||||||||||||
| 65 | au => 'Australia', | ||||||||||||
| 66 | aw => 'Aruba', | ||||||||||||
| 67 | ax => 'Åland', | ||||||||||||
| 68 | az => 'Azerbaiyán', | ||||||||||||
| 69 | ba => 'Bosnia-Herzegovina', | ||||||||||||
| 70 | bb => 'Barbados', | ||||||||||||
| 71 | bd => 'Bangladesh', | ||||||||||||
| 72 | be => 'Bélgica', | ||||||||||||
| 73 | bf => 'Burkina Faso', | ||||||||||||
| 74 | bg => 'Bulgaria', | ||||||||||||
| 75 | bh => 'Bahréin', | ||||||||||||
| 76 | bi => 'Burundi', | ||||||||||||
| 77 | bj => 'Benín', | ||||||||||||
| 78 | bm => 'Bermudas', | ||||||||||||
| 79 | bn => 'Brunei Darussalam', | ||||||||||||
| 80 | bo => 'Bolivia', | ||||||||||||
| 81 | br => 'Brasil', | ||||||||||||
| 82 | bs => 'Bahamas', | ||||||||||||
| 83 | bt => 'Bután', | ||||||||||||
| 84 | bu => 'Birmania', | ||||||||||||
| 85 | bv => 'Isla Bouvet', | ||||||||||||
| 86 | bw => 'Botsuana', | ||||||||||||
| 87 | by => 'Bielorrusia', | ||||||||||||
| 88 | bz => 'Belice', | ||||||||||||
| 89 | ca => 'Canadá', | ||||||||||||
| 90 | cc => 'Islas Cocos', | ||||||||||||
| 91 | cd => 'República Democrática del Congo', | ||||||||||||
| 92 | cf => 'República Centroafricana', | ||||||||||||
| 93 | cg => 'República del Congo', | ||||||||||||
| 94 | ch => 'Suiza', | ||||||||||||
| 95 | ci => 'Costa de Marfil', | ||||||||||||
| 96 | ck => 'Islas Cook', | ||||||||||||
| 97 | cl => 'Chile', | ||||||||||||
| 98 | cm => 'Camerún', | ||||||||||||
| 99 | cn => 'República Popular China', | ||||||||||||
| 100 | co => 'Colombia', | ||||||||||||
| 101 | cr => 'Costa Rica', | ||||||||||||
| 102 | cs => 'Serbia y Montenegro', | ||||||||||||
| 103 | cu => 'Cuba', | ||||||||||||
| 104 | cv => 'Cabo Verde', | ||||||||||||
| 105 | cx => 'Isla de Navidad', | ||||||||||||
| 106 | cy => 'Chipre', | ||||||||||||
| 107 | cz => 'República Checa', | ||||||||||||
| 108 | dd => 'República Democrática Alemana', | ||||||||||||
| 109 | de => 'Alemania', | ||||||||||||
| 110 | dj => 'Yibuti', | ||||||||||||
| 111 | dk => 'Dinamarca', | ||||||||||||
| 112 | dm => 'Dominica', | ||||||||||||
| 113 | do => 'República Dominicana', | ||||||||||||
| 114 | dz => 'Argelia', | ||||||||||||
| 115 | ec => 'Ecuador', | ||||||||||||
| 116 | ee => 'Estonia', | ||||||||||||
| 117 | eg => 'Egipto', | ||||||||||||
| 118 | eh => 'Sáhara Occidental', | ||||||||||||
| 119 | er => 'Eritrea', | ||||||||||||
| 120 | es => 'España', | ||||||||||||
| 121 | et => 'Etiopía', | ||||||||||||
| 122 | eu => 'Unión Europea', | ||||||||||||
| 123 | fi => 'Finlandia', | ||||||||||||
| 124 | fj => 'Fiyi', | ||||||||||||
| 125 | fk => 'Islas Malvinas', | ||||||||||||
| 126 | fm => 'Estados Federados de Micronesia', | ||||||||||||
| 127 | fo => 'Islas Feroe', | ||||||||||||
| 128 | fr => 'Francia', | ||||||||||||
| 129 | ga => 'Gabón', | ||||||||||||
| 130 | gb => 'Reino Unido', | ||||||||||||
| 131 | gd => 'Granada', | ||||||||||||
| 132 | ge => 'Georgia', | ||||||||||||
| 133 | gf => 'Guayana Francesa', | ||||||||||||
| 134 | gg => 'Guernesey', | ||||||||||||
| 135 | gh => 'Ghana', | ||||||||||||
| 136 | gi => 'Gibraltar', | ||||||||||||
| 137 | gl => 'Groenlandia', | ||||||||||||
| 138 | gm => 'Gambia', | ||||||||||||
| 139 | gn => 'Guinea', | ||||||||||||
| 140 | gp => 'Guadalupe', | ||||||||||||
| 141 | gq => 'Guinea Ecuatorial', | ||||||||||||
| 142 | gr => 'Grecia', | ||||||||||||
| 143 | gs => 'Islas Georgias del Sur y Sandwich del Sur', | ||||||||||||
| 144 | gt => 'Guatemala', | ||||||||||||
| 145 | gu => 'Guam', | ||||||||||||
| 146 | gw => 'Guinea-Bissau', | ||||||||||||
| 147 | gy => 'Guyana', | ||||||||||||
| 148 | hk => 'Hong Kong', | ||||||||||||
| 149 | hm => 'Islas Heard y McDonald', | ||||||||||||
| 150 | hn => 'Honduras', | ||||||||||||
| 151 | hr => 'Croacia', | ||||||||||||
| 152 | ht => 'Haití', | ||||||||||||
| 153 | hu => 'Hungría', | ||||||||||||
| 154 | id => 'Indonesia', | ||||||||||||
| 155 | ie => 'Irlanda', | ||||||||||||
| 156 | il => 'Israel', | ||||||||||||
| 157 | im => 'Isla de Man', | ||||||||||||
| 158 | in => 'India', | ||||||||||||
| 159 | io => 'Territorio Británico en el Océano Índico', | ||||||||||||
| 160 | iq => 'Iraq', | ||||||||||||
| 161 | ir => 'Irán', | ||||||||||||
| 162 | is => 'Islandia', | ||||||||||||
| 163 | it => 'Italia', | ||||||||||||
| 164 | je => 'Isla de Jersey', | ||||||||||||
| 165 | jm => 'Jamaica', | ||||||||||||
| 166 | jo => 'Jordania', | ||||||||||||
| 167 | jp => 'Japón', | ||||||||||||
| 168 | ke => 'Kenia', | ||||||||||||
| 169 | kg => 'Kirguistán', | ||||||||||||
| 170 | kh => 'Camboya', | ||||||||||||
| 171 | ki => 'Kiribati', | ||||||||||||
| 172 | km => 'Comoras', | ||||||||||||
| 173 | kn => 'San Cristóbal y Nieves', | ||||||||||||
| 174 | kp => 'Corea del Norte', | ||||||||||||
| 175 | kr => 'Corea del Sur', | ||||||||||||
| 176 | kw => 'Kuwait', | ||||||||||||
| 177 | ky => 'Islas Caimán', | ||||||||||||
| 178 | kz => 'Kazajistán', | ||||||||||||
| 179 | la => 'Laos', | ||||||||||||
| 180 | lb => 'Líbano', | ||||||||||||
| 181 | lc => 'Santa Lucía', | ||||||||||||
| 182 | li => 'Liechtenstein', | ||||||||||||
| 183 | lk => 'Sri Lanka', | ||||||||||||
| 184 | lr => 'Liberia', | ||||||||||||
| 185 | ls => 'Lesotho', | ||||||||||||
| 186 | lt => 'Lituania', | ||||||||||||
| 187 | lu => 'Luxemburgo', | ||||||||||||
| 188 | lv => 'Letonia', | ||||||||||||
| 189 | ly => 'Libia', | ||||||||||||
| 190 | ma => 'Marruecos', | ||||||||||||
| 191 | mc => 'Mónaco', | ||||||||||||
| 192 | md => 'Moldavia', | ||||||||||||
| 193 | me => 'Montenegro', | ||||||||||||
| 194 | mg => 'Madagascar', | ||||||||||||
| 195 | mh => 'Islas Marshall', | ||||||||||||
| 196 | mk => 'República de Macedonia', | ||||||||||||
| 197 | ml => 'Malí', | ||||||||||||
| 198 | mm => 'Myanmar', | ||||||||||||
| 199 | mn => 'Mongolia', | ||||||||||||
| 200 | mo => 'Macao', | ||||||||||||
| 201 | mp => 'Islas Marianas del Norte', | ||||||||||||
| 202 | mq => 'Martinica', | ||||||||||||
| 203 | mr => 'Mauritania', | ||||||||||||
| 204 | ms => 'Montserrat', | ||||||||||||
| 205 | mt => 'Malta', | ||||||||||||
| 206 | mu => 'Mauricio', | ||||||||||||
| 207 | mv => 'Maldivas', | ||||||||||||
| 208 | mw => 'Malawi', | ||||||||||||
| 209 | mx => 'México', | ||||||||||||
| 210 | my => 'Malasia', | ||||||||||||
| 211 | mz => 'Mozambique', | ||||||||||||
| 212 | na => 'Namibia', | ||||||||||||
| 213 | nc => 'Nueva Caledonia', | ||||||||||||
| 214 | ne => 'Níger', | ||||||||||||
| 215 | nf => 'Isla Norfolk', | ||||||||||||
| 216 | ng => 'Nigeria', | ||||||||||||
| 217 | ni => 'Nicaragua', | ||||||||||||
| 218 | nl => 'Países Bajos', | ||||||||||||
| 219 | no => 'Noruega', | ||||||||||||
| 220 | np => 'Nepal', | ||||||||||||
| 221 | nr => 'Nauru', | ||||||||||||
| 222 | nu => 'Niue', | ||||||||||||
| 223 | nz => 'Nueva Zelanda', | ||||||||||||
| 224 | om => 'Omán', | ||||||||||||
| 225 | pa => 'Panamá', | ||||||||||||
| 226 | pe => 'Perú', | ||||||||||||
| 227 | pf => 'Polinesia Francesa', | ||||||||||||
| 228 | pg => 'Papúa Nueva Guinea', | ||||||||||||
| 229 | ph => 'Filipinas', | ||||||||||||
| 230 | pk => 'Pakistán', | ||||||||||||
| 231 | pl => 'Polonia', | ||||||||||||
| 232 | pm => 'San Pedro y Miquelón', | ||||||||||||
| 233 | pn => 'Islas Pitcairn', | ||||||||||||
| 234 | pr => 'Puerto Rico', | ||||||||||||
| 235 | ps => 'Palestina', | ||||||||||||
| 236 | pt => 'Portugal', | ||||||||||||
| 237 | pw => 'Palaos', | ||||||||||||
| 238 | py => 'Paraguay', | ||||||||||||
| 239 | qa => 'Qatar', | ||||||||||||
| 240 | re => 'Reunión', | ||||||||||||
| 241 | ro => 'Rumania', | ||||||||||||
| 242 | rs => 'Serbia', | ||||||||||||
| 243 | ru => 'Rusia', | ||||||||||||
| 244 | rw => 'Ruanda', | ||||||||||||
| 245 | sa => 'Arabia Saudita', | ||||||||||||
| 246 | sb => 'Islas Salomón', | ||||||||||||
| 247 | sc => 'Seychelles', | ||||||||||||
| 248 | sd => 'Sudán', | ||||||||||||
| 249 | se => 'Suecia', | ||||||||||||
| 250 | sg => 'Singapur', | ||||||||||||
| 251 | sh => 'Santa Helena', | ||||||||||||
| 252 | si => 'Eslovenia', | ||||||||||||
| 253 | sj => 'Svalbard y Jan Mayen', | ||||||||||||
| 254 | sk => 'Eslovaquia', | ||||||||||||
| 255 | sl => 'Sierra Leona', | ||||||||||||
| 256 | sm => 'San Marino', | ||||||||||||
| 257 | sn => 'Senegal', | ||||||||||||
| 258 | so => 'Somalia', | ||||||||||||
| 259 | sr => 'Surinam', | ||||||||||||
| 260 | st => 'Santo Tomé y Príncipe', | ||||||||||||
| 261 | su => 'Antigua Unión Soviética', | ||||||||||||
| 262 | sv => 'El Salvador', | ||||||||||||
| 263 | sy => 'Siria', | ||||||||||||
| 264 | sz => 'Swazilandia', | ||||||||||||
| 265 | tc => 'Islas Turcas y Caicos', | ||||||||||||
| 266 | td => 'Chad', | ||||||||||||
| 267 | tf => 'Territorios Australes Franceses', | ||||||||||||
| 268 | tg => 'Togo', | ||||||||||||
| 269 | th => 'Tailandia', | ||||||||||||
| 270 | tj => 'Tayikistán', | ||||||||||||
| 271 | tk => 'Tokelau', | ||||||||||||
| 272 | tl => 'Timor Oriental', | ||||||||||||
| 273 | tm => 'Turkmenistán', | ||||||||||||
| 274 | tn => 'Túnez', | ||||||||||||
| 275 | to => 'Tonga', | ||||||||||||
| 276 | tp => 'Timor Oriental', | ||||||||||||
| 277 | tr => 'Turquía', | ||||||||||||
| 278 | tt => 'Trinidad y Tobago', | ||||||||||||
| 279 | tv => 'Tuvalu', | ||||||||||||
| 280 | tw => 'Taiwán', | ||||||||||||
| 281 | tz => 'Tanzania', | ||||||||||||
| 282 | ua => 'Ucrania', | ||||||||||||
| 283 | ug => 'Uganda', | ||||||||||||
| 284 | uk => 'Reino Unido', | ||||||||||||
| 285 | um => 'Islas Ultramarinas de Estados Unidos', | ||||||||||||
| 286 | us => 'Estados Unidos', | ||||||||||||
| 287 | uy => 'Uruguay', | ||||||||||||
| 288 | uz => 'Uzbekistán', | ||||||||||||
| 289 | va => 'Ciudad del Vaticano', | ||||||||||||
| 290 | vc => 'San Vicente y las Granadinas', | ||||||||||||
| 291 | ve => 'Venezuela', | ||||||||||||
| 292 | vg => 'Islas Vírgenes Británicas', | ||||||||||||
| 293 | vi => 'Islas Vírgenes de los Estados Unidos', | ||||||||||||
| 294 | vn => 'Vietnam', | ||||||||||||
| 295 | vu => 'Vanuatu', | ||||||||||||
| 296 | wf => 'Wallis y Futuna', | ||||||||||||
| 297 | ws => 'Samoa', | ||||||||||||
| 298 | ye => 'Yemen', | ||||||||||||
| 299 | yt => 'Mayotte', | ||||||||||||
| 300 | yu => 'Yugoslavia', | ||||||||||||
| 301 | za => 'Sudáfrica', | ||||||||||||
| 302 | zm => 'Zambia', | ||||||||||||
| 303 | zr => 'Zaire', | ||||||||||||
| 304 | zw => 'Zimbabue', | ||||||||||||
| 305 | ); | ||||||||||||
| 306 | |||||||||||||
| 307 | 5 | ▶ | sub find_name_by_cctld { | ||||||||||
|
Subroutine
find_name_by_cctld: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||
| 308 | 5 | ▶ | $_cc_map{ $_[0] || croak 'no argument passed' } | ||||||||||
|
Condition100%2/2
$_[0] || croak('no argument passed')
MC/DC100%1/1
$_[0] || croak('no argument passed')
$_[0]
Truth table100%2/2
A
A= $_[0]
| |||||||||||||
| 309 | } | ||||||||||||
| 310 | |||||||||||||
| 311 | =head1 AUTHOR | ||||||||||||
| 312 | |||||||||||||
| 313 | David Moreno, C<< <david at axiombox.com> >> | ||||||||||||
| 314 | |||||||||||||
| 315 | =head1 BUGS | ||||||||||||
| 316 | |||||||||||||
| 317 | Please report any bugs or feature requests to C<bug-net-domain-es-cctld at rt.cpan.org>, or through | ||||||||||||
| 318 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Domain-ES-ccTLD>. | ||||||||||||
| 319 | I will be notified, and then you'll | ||||||||||||
| 320 | automatically be notified of progress on your bug as I make changes. | ||||||||||||
| 321 | |||||||||||||
| 322 | =head1 SUPPORT | ||||||||||||
| 323 | |||||||||||||
| 324 | You can find documentation for this module with the perldoc command. | ||||||||||||
| 325 | |||||||||||||
| 326 | perldoc Net::Domain::ES::ccTLD | ||||||||||||
| 327 | |||||||||||||
| 328 | You can also look for information at: | ||||||||||||
| 329 | |||||||||||||
| 330 | =over 4 | ||||||||||||
| 331 | |||||||||||||
| 332 | =item * RT: CPAN's request tracker | ||||||||||||
| 333 | |||||||||||||
| 334 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Domain-ES-ccTLD> | ||||||||||||
| 335 | |||||||||||||
| 336 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||
| 337 | |||||||||||||
| 338 | L<http://annocpan.org/dist/Net-Domain-ES-ccTLD> | ||||||||||||
| 339 | |||||||||||||
| 340 | =item * CPAN Ratings | ||||||||||||
| 341 | |||||||||||||
| 342 | L<http://cpanratings.perl.org/d/Net-Domain-ES-ccTLD> | ||||||||||||
| 343 | |||||||||||||
| 344 | =item * Search CPAN | ||||||||||||
| 345 | |||||||||||||
| 346 | L<http://search.cpan.org/dist/Net-Domain-ES-ccTLD/> | ||||||||||||
| 347 | |||||||||||||
| 348 | =back | ||||||||||||
| 349 | |||||||||||||
| 350 | =head1 COPYRIGHT & LICENSE | ||||||||||||
| 351 | |||||||||||||
| 352 | Copyright 2009-2012 David Moreno. | ||||||||||||
| 353 | |||||||||||||
| 354 | This library is free software; you can redistribute it and/or modify it | ||||||||||||
| 355 | under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, | ||||||||||||
| 356 | any later version of Perl 5 you may have available. | ||||||||||||
| 357 | |||||||||||||
| 358 | =cut | ||||||||||||
| 359 | |||||||||||||
| 360 | 4 | 1; # End of Net::Domain::ES::ccTLD | |||||||||||