1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
|
#!/usr/bin/perl -w
use strict;
use WebService::CIA::Source::Web;
use WebService::CIA::Source::DBM;
my $dbm = WebService::CIA::Source::DBM->new({ DBM => 'factbook.dbm', Mode => 'readwrite' });
my $web = WebService::CIA::Source::Web->new();
chomp (my @data = <DATA>);
for (my $i = 0; $i < scalar @data; $i++) {
next unless $data[$i];
my ($cc, $name) = split /:/, $data[$i];
printf "%3d/%3d %s (%s) ... ", $i + 1, scalar @data, $name, $cc;
my $vals = $web->all($cc);
if (scalar keys %$vals > 0) {
$dbm->set($cc, $vals);
print "done\n";
} else {
print "no data found\n";
}
}
__DATA__
af:Afghanistan
al:Albania
ag:Algeria
aq:American Samoa
an:Andorra
ao:Angola
av:Anguilla
ay:Antarctica
ac:Antigua and Barbuda
xq:Arctic Ocean
ar:Argentina
am:Armenia
aa:Aruba
at:Ashmore and Cartier Islands
zh:Atlantic Ocean
as:Australia
au:Austria
aj:Azerbaijan
bf:Bahamas, The
ba:Bahrain
fq:Baker Island
bg:Bangladesh
bb:Barbados
bs:Bassas da India
bo:Belarus
be:Belgium
bh:Belize
bn:Benin
bd:Bermuda
bt:Bhutan
bl:Bolivia
bk:Bosnia and Herzegovina
bc:Botswana
bv:Bouvet Island
br:Brazil
io:British Indian Ocean Territory
vi:British Virgin Islands
bx:Brunei
bu:Bulgaria
uv:Burkina Faso
bm:Burma
by:Burundi
cb:Cambodia
cm:Cameroon
ca:Canada
cv:Cape Verde
cj:Cayman Islands
ct:Central African Republic
cd:Chad
ci:Chile
ch:China
kt:Christmas Island
ip:Clipperton Island
ck:Cocos (Keeling) Islands
co:Colombia
cn:Comoros
cg:Congo, Democratic Republic of the
cf:Congo, Republic of the
cw:Cook Islands
cr:Coral Sea Islands
cs:Costa Rica
iv:Cote d'Ivoire
hr:Croatia
cu:Cuba
cy:Cyprus
ez:Czech Republic
da:Denmark
dj:Djibouti
do:Dominica
dr:Dominican Republic
tt:East Timor
ec:Ecuador
eg:Egypt
es:El Salvador
ek:Equatorial Guinea
er:Eritrea
en:Estonia
et:Ethiopia
eu:Europa Island
fk:Falkland Islands (Islas Malvinas)
fo:Faroe Islands
fj:Fiji
fi:Finland
fr:France
fg:French Guiana
fp:French Polynesia
fs:French Southern and Antarctic Lands
gb:Gabon
ga:Gambia, The
gz:Gaza Strip
gg:Georgia
gm:Germany
gh:Ghana
gi:Gibraltar
go:Glorioso Islands
gr:Greece
gl:Greenland
gj:Grenada
gp:Guadeloupe
gq:Guam
gt:Guatemala
gk:Guernsey
gv:Guinea
pu:Guinea-Bissau
gy:Guyana
ha:Haiti
hm:Heard Island and McDonald Islands
vt:Holy See (Vatican City)
ho:Honduras
hk:Hong Kong
hq:Howland Island
hu:Hungary
ic:Iceland
in:India
xo:Indian Ocean
id:Indonesia
ir:Iran
iz:Iraq
ei:Ireland
is:Israel
it:Italy
jm:Jamaica
jn:Jan Mayen
ja:Japan
dq:Jarvis Island
je:Jersey
jq:Johnston Atoll
jo:Jordan
ju:Juan de Nova Island
kz:Kazakhstan
ke:Kenya
kq:Kingman Reef
kr:Kiribati
kn:Korea, North
ks:Korea, South
ku:Kuwait
kg:Kyrgyzstan
la:Laos
lg:Latvia
le:Lebanon
lt:Lesotho
li:Liberia
ly:Libya
ls:Liechtenstein
lh:Lithuania
lu:Luxembourg
mc:Macau
mk:Macedonia, The Former Yugoslav Republic of
ma:Madagascar
mi:Malawi
my:Malaysia
mv:Maldives
ml:Mali
mt:Malta
im:Man, Isle of
rm:Marshall Islands
mb:Martinique
mr:Mauritania
mp:Mauritius
mf:Mayotte
mx:Mexico
fm:Micronesia, Federated States of
mq:Midway Islands
md:Moldova
mn:Monaco
mg:Mongolia
mh:Montserrat
mo:Morocco
mz:Mozambique
wa:Namibia
nr:Nauru
bq:Navassa Island
np:Nepal
nl:Netherlands
nt:Netherlands Antilles
nc:New Caledonia
nz:New Zealand
nu:Nicaragua
ng:Niger
ni:Nigeria
ne:Niue
nf:Norfolk Island
cq:Northern Mariana Islands
no:Norway
mu:Oman
zn:Pacific Ocean
pk:Pakistan
ps:Palau
lq:Palmyra Atoll
pm:Panama
pp:Papua New Guinea
pf:Paracel Islands
pa:Paraguay
pe:Peru
rp:Philippines
pc:Pitcairn Islands
pl:Poland
po:Portugal
rq:Puerto Rico
qa:Qatar
re:Reunion
ro:Romania
rs:Russia
rw:Rwanda
sh:Saint Helena
sc:Saint Kitts and Nevis
st:Saint Lucia
sb:Saint Pierre and Miquelon
vc:Saint Vincent and the Grenadines
ws:Samoa
sm:San Marino
tp:Sao Tome and Principe
sa:Saudi Arabia
sg:Senegal
yi:Serbia and Montenegro
se:Seychelles
sl:Sierra Leone
sn:Singapore
lo:Slovakia
si:Slovenia
bp:Solomon Islands
so:Somalia
sf:South Africa
sx:South Georgia and the South Sandwich Islands
oo:Southern Ocean
sp:Spain
pg:Spratly Islands
ce:Sri Lanka
su:Sudan
ns:Suriname
sv:Svalbard
wz:Swaziland
sw:Sweden
sz:Switzerland
sy:Syria
ti:Tajikistan
tz:Tanzania
th:Thailand
to:Togo
tl:Tokelau
tn:Tonga
td:Trinidad and Tobago
te:Tromelin Island
ts:Tunisia
tu:Turkey
tx:Turkmenistan
tk:Turks and Caicos Islands
tv:Tuvalu
ug:Uganda
up:Ukraine
tc:United Arab Emirates
uk:United Kingdom
us:United States
uy:Uruguay
uz:Uzbekistan
nh:Vanuatu
ve:Venezuela
vm:Vietnam
vq:Virgin Islands
wq:Wake Island
wf:Wallis and Futuna
we:West Bank
wi:Western Sahara
xx:World
ym:Yemen
za:Zambia
zi:Zimbabwe
tw:Taiwan
|