| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Gazetteer::Getty; |
|
2
|
1
|
|
|
1
|
|
1580
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
37
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
35
|
|
|
4
|
1
|
|
|
1
|
|
4
|
use Carp qw(croak); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
57
|
|
|
5
|
1
|
|
|
1
|
|
945
|
use HTTP::Cookies; |
|
|
1
|
|
|
|
|
18137
|
|
|
|
1
|
|
|
|
|
29
|
|
|
6
|
1
|
|
|
1
|
|
5648
|
use LWP::UserAgent; |
|
|
1
|
|
|
|
|
58340
|
|
|
|
1
|
|
|
|
|
39
|
|
|
7
|
1
|
|
|
1
|
|
1065
|
use URI::QueryParam; |
|
|
1
|
|
|
|
|
1012
|
|
|
|
1
|
|
|
|
|
34
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
8
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
1248
|
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.11'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $countries = { |
|
13
|
|
|
|
|
|
|
af => 'Afghanistan', |
|
14
|
|
|
|
|
|
|
al => 'Albania', |
|
15
|
|
|
|
|
|
|
dz => 'Algeria', |
|
16
|
|
|
|
|
|
|
as => 'American Samoa', |
|
17
|
|
|
|
|
|
|
ad => 'Andorra', |
|
18
|
|
|
|
|
|
|
ao => 'Angola', |
|
19
|
|
|
|
|
|
|
ai => 'Anguilla', |
|
20
|
|
|
|
|
|
|
aq => 'Antarctica', |
|
21
|
|
|
|
|
|
|
ag => 'Antigua and Barbuda', |
|
22
|
|
|
|
|
|
|
ar => 'Argentina', |
|
23
|
|
|
|
|
|
|
am => 'Armenia', |
|
24
|
|
|
|
|
|
|
aw => 'Aruba', |
|
25
|
|
|
|
|
|
|
au => 'Australia', |
|
26
|
|
|
|
|
|
|
at => 'Austria', |
|
27
|
|
|
|
|
|
|
az => 'Azerbaijan', |
|
28
|
|
|
|
|
|
|
bs => 'Bahamas', |
|
29
|
|
|
|
|
|
|
bh => 'Bahrain', |
|
30
|
|
|
|
|
|
|
bd => 'Bangladesh', |
|
31
|
|
|
|
|
|
|
bb => 'Barbados', |
|
32
|
|
|
|
|
|
|
by => 'Belarus', |
|
33
|
|
|
|
|
|
|
be => 'Belgium', |
|
34
|
|
|
|
|
|
|
bz => 'Belize', |
|
35
|
|
|
|
|
|
|
bj => 'Benin', |
|
36
|
|
|
|
|
|
|
bm => 'Bermuda', |
|
37
|
|
|
|
|
|
|
bt => 'Bhutan', |
|
38
|
|
|
|
|
|
|
bo => 'Bolivia', |
|
39
|
|
|
|
|
|
|
ba => 'Bosnia and Herzegovina', |
|
40
|
|
|
|
|
|
|
bw => 'Botswana', |
|
41
|
|
|
|
|
|
|
bv => 'Bouvet Island', |
|
42
|
|
|
|
|
|
|
br => 'Brazil', |
|
43
|
|
|
|
|
|
|
io => 'British Indian Ocean Territory', |
|
44
|
|
|
|
|
|
|
bn => 'Brunei Darussalam', |
|
45
|
|
|
|
|
|
|
bg => 'Bulgaria', |
|
46
|
|
|
|
|
|
|
bf => 'Burkina Faso', |
|
47
|
|
|
|
|
|
|
bi => 'Burundi', |
|
48
|
|
|
|
|
|
|
kh => 'Cambodia', |
|
49
|
|
|
|
|
|
|
cm => 'Cameroon', |
|
50
|
|
|
|
|
|
|
ca => 'Canada', |
|
51
|
|
|
|
|
|
|
cv => 'Cape Verde', |
|
52
|
|
|
|
|
|
|
ky => 'Cayman Islands', |
|
53
|
|
|
|
|
|
|
cf => 'Central African Republic', |
|
54
|
|
|
|
|
|
|
td => 'Chad', |
|
55
|
|
|
|
|
|
|
cl => 'Chile', |
|
56
|
|
|
|
|
|
|
cn => 'China', |
|
57
|
|
|
|
|
|
|
cx => 'Christmas Island', |
|
58
|
|
|
|
|
|
|
cc => 'Cocos (Keeling) Islands', |
|
59
|
|
|
|
|
|
|
co => 'Colombia', |
|
60
|
|
|
|
|
|
|
km => 'Comoros', |
|
61
|
|
|
|
|
|
|
cg => 'Congo', |
|
62
|
|
|
|
|
|
|
ck => 'Cook Islands', |
|
63
|
|
|
|
|
|
|
cr => 'Costa Rica', |
|
64
|
|
|
|
|
|
|
ci => "Cote D'Ivoire", |
|
65
|
|
|
|
|
|
|
hr => 'Croatia', |
|
66
|
|
|
|
|
|
|
cu => 'Cuba', |
|
67
|
|
|
|
|
|
|
cy => 'Cyprus', |
|
68
|
|
|
|
|
|
|
cz => 'Czech Republic', |
|
69
|
|
|
|
|
|
|
dk => 'Denmark', |
|
70
|
|
|
|
|
|
|
dj => 'Djibouti', |
|
71
|
|
|
|
|
|
|
dm => 'Dominica', |
|
72
|
|
|
|
|
|
|
do => 'Dominican Republic', |
|
73
|
|
|
|
|
|
|
tl => 'East Timor', |
|
74
|
|
|
|
|
|
|
ec => 'Ecuador', |
|
75
|
|
|
|
|
|
|
eg => 'Egypt', |
|
76
|
|
|
|
|
|
|
sv => 'El Salvador', |
|
77
|
|
|
|
|
|
|
gq => 'Equatorial Guinea', |
|
78
|
|
|
|
|
|
|
er => 'Eritrea', |
|
79
|
|
|
|
|
|
|
ee => 'Estonia', |
|
80
|
|
|
|
|
|
|
et => 'Ethiopia', |
|
81
|
|
|
|
|
|
|
fk => 'Falkland Islands (Malvinas)', |
|
82
|
|
|
|
|
|
|
fo => 'Faroe Islands', |
|
83
|
|
|
|
|
|
|
fj => 'Fiji', |
|
84
|
|
|
|
|
|
|
fi => 'Finland', |
|
85
|
|
|
|
|
|
|
fr => 'France', |
|
86
|
|
|
|
|
|
|
fx => 'France, Metropolitan', |
|
87
|
|
|
|
|
|
|
gf => 'French Guiana', |
|
88
|
|
|
|
|
|
|
pf => 'French Polynesia', |
|
89
|
|
|
|
|
|
|
tf => 'French Southern Territories', |
|
90
|
|
|
|
|
|
|
ga => 'Gabon', |
|
91
|
|
|
|
|
|
|
gm => 'Gambia', |
|
92
|
|
|
|
|
|
|
ge => 'Georgia', |
|
93
|
|
|
|
|
|
|
de => 'Germany', |
|
94
|
|
|
|
|
|
|
gh => 'Ghana', |
|
95
|
|
|
|
|
|
|
gi => 'Gibraltar', |
|
96
|
|
|
|
|
|
|
gr => 'Greece', |
|
97
|
|
|
|
|
|
|
gl => 'Greenland', |
|
98
|
|
|
|
|
|
|
gd => 'Grenada', |
|
99
|
|
|
|
|
|
|
gp => 'Guadeloupe', |
|
100
|
|
|
|
|
|
|
gu => 'Guam', |
|
101
|
|
|
|
|
|
|
gt => 'Guatemala', |
|
102
|
|
|
|
|
|
|
gn => 'Guinea', |
|
103
|
|
|
|
|
|
|
gw => 'Guinea-Bissau', |
|
104
|
|
|
|
|
|
|
gy => 'Guyana', |
|
105
|
|
|
|
|
|
|
ht => 'Haiti', |
|
106
|
|
|
|
|
|
|
hm => 'Heard Island and McDonald Islands', |
|
107
|
|
|
|
|
|
|
va => 'Holy See (Vatican City State)', |
|
108
|
|
|
|
|
|
|
hn => 'Honduras', |
|
109
|
|
|
|
|
|
|
hk => 'Hong Kong', |
|
110
|
|
|
|
|
|
|
hu => 'Hungary', |
|
111
|
|
|
|
|
|
|
is => 'Iceland', |
|
112
|
|
|
|
|
|
|
in => 'India', |
|
113
|
|
|
|
|
|
|
id => 'Indonesia', |
|
114
|
|
|
|
|
|
|
ir => 'Iran, Islamic Republic of', |
|
115
|
|
|
|
|
|
|
iq => 'Iraq', |
|
116
|
|
|
|
|
|
|
ie => 'Ireland', |
|
117
|
|
|
|
|
|
|
il => 'Israel', |
|
118
|
|
|
|
|
|
|
it => 'Italy', |
|
119
|
|
|
|
|
|
|
jm => 'Jamaica', |
|
120
|
|
|
|
|
|
|
jp => 'Japan', |
|
121
|
|
|
|
|
|
|
jo => 'Jordan', |
|
122
|
|
|
|
|
|
|
kz => 'Kazakhstan', |
|
123
|
|
|
|
|
|
|
ke => 'Kenya', |
|
124
|
|
|
|
|
|
|
ki => 'Kiribati', |
|
125
|
|
|
|
|
|
|
kp => "Korea, Democratic People's Republic of", |
|
126
|
|
|
|
|
|
|
kr => 'Korea, Republic of', |
|
127
|
|
|
|
|
|
|
kw => 'Kuwait', |
|
128
|
|
|
|
|
|
|
kg => 'Kyrgyzstan', |
|
129
|
|
|
|
|
|
|
la => "Lao People's Democratic Republic", |
|
130
|
|
|
|
|
|
|
lv => 'Latvia', |
|
131
|
|
|
|
|
|
|
lb => 'Lebanon', |
|
132
|
|
|
|
|
|
|
ls => 'Lesotho', |
|
133
|
|
|
|
|
|
|
lr => 'Liberia', |
|
134
|
|
|
|
|
|
|
ly => 'Libyan Arab Jamahiriya', |
|
135
|
|
|
|
|
|
|
li => 'Liechtenstein', |
|
136
|
|
|
|
|
|
|
lt => 'Lithuania', |
|
137
|
|
|
|
|
|
|
lu => 'Luxembourg', |
|
138
|
|
|
|
|
|
|
mo => 'Macao', |
|
139
|
|
|
|
|
|
|
mk => 'Macedonia, the Former Yugoslav Republic of', |
|
140
|
|
|
|
|
|
|
mg => 'Madagascar', |
|
141
|
|
|
|
|
|
|
mw => 'Malawi', |
|
142
|
|
|
|
|
|
|
my => 'Malaysia', |
|
143
|
|
|
|
|
|
|
mv => 'Maldives', |
|
144
|
|
|
|
|
|
|
ml => 'Mali', |
|
145
|
|
|
|
|
|
|
mt => 'Malta', |
|
146
|
|
|
|
|
|
|
mh => 'Marshall Islands', |
|
147
|
|
|
|
|
|
|
mq => 'Martinique', |
|
148
|
|
|
|
|
|
|
mr => 'Mauritania', |
|
149
|
|
|
|
|
|
|
mu => 'Mauritius', |
|
150
|
|
|
|
|
|
|
yt => 'Mayotte', |
|
151
|
|
|
|
|
|
|
mx => 'Mexico', |
|
152
|
|
|
|
|
|
|
fm => 'Micronesia, Federated States of', |
|
153
|
|
|
|
|
|
|
md => 'Moldova, Republic of', |
|
154
|
|
|
|
|
|
|
mc => 'Monaco', |
|
155
|
|
|
|
|
|
|
mn => 'Mongolia', |
|
156
|
|
|
|
|
|
|
ms => 'Montserrat', |
|
157
|
|
|
|
|
|
|
ma => 'Morocco', |
|
158
|
|
|
|
|
|
|
mz => 'Mozambique', |
|
159
|
|
|
|
|
|
|
mm => 'Myanmar', |
|
160
|
|
|
|
|
|
|
na => 'Namibia', |
|
161
|
|
|
|
|
|
|
nr => 'Nauru', |
|
162
|
|
|
|
|
|
|
np => 'Nepal', |
|
163
|
|
|
|
|
|
|
nl => 'Netherlands', |
|
164
|
|
|
|
|
|
|
an => 'Netherlands Antilles', |
|
165
|
|
|
|
|
|
|
nc => 'New Caledonia', |
|
166
|
|
|
|
|
|
|
nz => 'New Zealand', |
|
167
|
|
|
|
|
|
|
ni => 'Nicaragua', |
|
168
|
|
|
|
|
|
|
ne => 'Niger', |
|
169
|
|
|
|
|
|
|
ng => 'Nigeria', |
|
170
|
|
|
|
|
|
|
nu => 'Niue', |
|
171
|
|
|
|
|
|
|
nf => 'Norfolk Island', |
|
172
|
|
|
|
|
|
|
mp => 'Northern Mariana Islands', |
|
173
|
|
|
|
|
|
|
no => 'Norway', |
|
174
|
|
|
|
|
|
|
om => 'Oman', |
|
175
|
|
|
|
|
|
|
pk => 'Pakistan', |
|
176
|
|
|
|
|
|
|
pw => 'Palau', |
|
177
|
|
|
|
|
|
|
ps => 'Palestinian Territory, Occupied', |
|
178
|
|
|
|
|
|
|
pa => 'Panama', |
|
179
|
|
|
|
|
|
|
pg => 'Papua New Guinea', |
|
180
|
|
|
|
|
|
|
py => 'Paraguay', |
|
181
|
|
|
|
|
|
|
pe => 'Peru', |
|
182
|
|
|
|
|
|
|
ph => 'Philippines', |
|
183
|
|
|
|
|
|
|
pn => 'Pitcairn', |
|
184
|
|
|
|
|
|
|
pl => 'Poland', |
|
185
|
|
|
|
|
|
|
pt => 'Portugal', |
|
186
|
|
|
|
|
|
|
pr => 'Puerto Rico', |
|
187
|
|
|
|
|
|
|
qa => 'Qatar', |
|
188
|
|
|
|
|
|
|
re => 'Reunion', |
|
189
|
|
|
|
|
|
|
ro => 'Romania', |
|
190
|
|
|
|
|
|
|
ru => 'Russian Federation', |
|
191
|
|
|
|
|
|
|
rw => 'Rwanda', |
|
192
|
|
|
|
|
|
|
sh => 'Saint Helena', |
|
193
|
|
|
|
|
|
|
kn => 'Saint Kitts and Nevis', |
|
194
|
|
|
|
|
|
|
lc => 'Saint Lucia', |
|
195
|
|
|
|
|
|
|
pm => 'Saint Pierre and Miquelon', |
|
196
|
|
|
|
|
|
|
vc => 'Saint Vincent and the Grenadines', |
|
197
|
|
|
|
|
|
|
ws => 'Samoa', |
|
198
|
|
|
|
|
|
|
sm => 'San Marino', |
|
199
|
|
|
|
|
|
|
st => 'Sao Tome and Principe', |
|
200
|
|
|
|
|
|
|
sa => 'Saudi Arabia', |
|
201
|
|
|
|
|
|
|
sn => 'Senegal', |
|
202
|
|
|
|
|
|
|
sc => 'Seychelles', |
|
203
|
|
|
|
|
|
|
sl => 'Sierra Leone', |
|
204
|
|
|
|
|
|
|
sg => 'Singapore', |
|
205
|
|
|
|
|
|
|
sk => 'Slovakia', |
|
206
|
|
|
|
|
|
|
si => 'Slovenia', |
|
207
|
|
|
|
|
|
|
sb => 'Solomon Islands', |
|
208
|
|
|
|
|
|
|
so => 'Somalia', |
|
209
|
|
|
|
|
|
|
za => 'South Africa', |
|
210
|
|
|
|
|
|
|
gs => 'South Georgia and the South Sandwich Islands', |
|
211
|
|
|
|
|
|
|
es => 'Spain', |
|
212
|
|
|
|
|
|
|
lk => 'Sri Lanka', |
|
213
|
|
|
|
|
|
|
sd => 'Sudan', |
|
214
|
|
|
|
|
|
|
sr => 'Suriname', |
|
215
|
|
|
|
|
|
|
sj => 'Svalbard and Jan Mayen', |
|
216
|
|
|
|
|
|
|
sz => 'Swaziland', |
|
217
|
|
|
|
|
|
|
se => 'Sweden', |
|
218
|
|
|
|
|
|
|
ch => 'Switzerland', |
|
219
|
|
|
|
|
|
|
sy => 'Syrian Arab Republic', |
|
220
|
|
|
|
|
|
|
tw => 'Taiwan, Province of China', |
|
221
|
|
|
|
|
|
|
tj => 'Tajikistan', |
|
222
|
|
|
|
|
|
|
tz => 'Tanzania, United Republic of', |
|
223
|
|
|
|
|
|
|
th => 'Thailand', |
|
224
|
|
|
|
|
|
|
tg => 'Togo', |
|
225
|
|
|
|
|
|
|
tk => 'Tokelau', |
|
226
|
|
|
|
|
|
|
to => 'Tonga', |
|
227
|
|
|
|
|
|
|
tt => 'Trinidad and Tobago', |
|
228
|
|
|
|
|
|
|
tn => 'Tunisia', |
|
229
|
|
|
|
|
|
|
tr => 'Turkey', |
|
230
|
|
|
|
|
|
|
tm => 'Turkmenistan', |
|
231
|
|
|
|
|
|
|
tc => 'Turks and Caicos Islands', |
|
232
|
|
|
|
|
|
|
tv => 'Tuvalu', |
|
233
|
|
|
|
|
|
|
ug => 'Uganda', |
|
234
|
|
|
|
|
|
|
ua => 'Ukraine', |
|
235
|
|
|
|
|
|
|
ae => 'United Arab Emirates', |
|
236
|
|
|
|
|
|
|
gb => 'United Kingdom', |
|
237
|
|
|
|
|
|
|
uk => 'United Kingdom', |
|
238
|
|
|
|
|
|
|
us => 'United States', |
|
239
|
|
|
|
|
|
|
um => 'United States Minor Outlying Islands', |
|
240
|
|
|
|
|
|
|
uy => 'Uruguay', |
|
241
|
|
|
|
|
|
|
uz => 'Uzbekistan', |
|
242
|
|
|
|
|
|
|
vu => 'Vanuatu', |
|
243
|
|
|
|
|
|
|
ve => 'Venezuela', |
|
244
|
|
|
|
|
|
|
vn => 'Vietnam', |
|
245
|
|
|
|
|
|
|
vg => 'Virgin Islands, British', |
|
246
|
|
|
|
|
|
|
vi => 'Virgin Islands, U.S.', |
|
247
|
|
|
|
|
|
|
wf => 'Wallis and Futuna', |
|
248
|
|
|
|
|
|
|
eh => 'Western Sahara', |
|
249
|
|
|
|
|
|
|
ye => 'Yemen', |
|
250
|
|
|
|
|
|
|
yu => 'Yugoslavia', |
|
251
|
|
|
|
|
|
|
zr => 'Zaire', |
|
252
|
|
|
|
|
|
|
zm => 'Zambia', |
|
253
|
|
|
|
|
|
|
zw => 'Zimbabwe', |
|
254
|
|
|
|
|
|
|
}; |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
sub new { |
|
257
|
1
|
|
|
1
|
1
|
1449
|
my ($class) = @_; |
|
258
|
|
|
|
|
|
|
|
|
259
|
1
|
|
|
|
|
3
|
my $self = {}; |
|
260
|
1
|
|
|
|
|
10
|
my $ua = LWP::UserAgent->new( |
|
261
|
|
|
|
|
|
|
env_proxy => 1, |
|
262
|
|
|
|
|
|
|
keep_alive => 1, |
|
263
|
|
|
|
|
|
|
timeout => 30, |
|
264
|
|
|
|
|
|
|
); |
|
265
|
1
|
|
|
|
|
34448
|
$ua->agent( "WWW::Gazetteer::Getty/$VERSION " . $ua->agent ); |
|
266
|
|
|
|
|
|
|
|
|
267
|
1
|
|
|
|
|
114
|
$self->{ua} = $ua; |
|
268
|
|
|
|
|
|
|
|
|
269
|
1
|
|
|
|
|
7
|
bless $self, $class; |
|
270
|
1
|
|
|
|
|
14
|
return $self; |
|
271
|
|
|
|
|
|
|
} |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
sub find { |
|
274
|
3
|
|
|
3
|
1
|
16
|
my ( $self, $city, $country ) = @_; |
|
275
|
|
|
|
|
|
|
|
|
276
|
3
|
100
|
|
|
|
16
|
if ( $countries->{ lc $country } ) { |
|
277
|
1
|
|
|
|
|
3
|
$country = $countries->{ lc $country }; |
|
278
|
|
|
|
|
|
|
} |
|
279
|
|
|
|
|
|
|
|
|
280
|
3
|
|
|
|
|
11
|
my $ua = $self->{ua}; |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
# http://www.getty.edu/vow/TGNServlet?english=Y&find=London&place=&page=1&nation=United+Kingdom |
|
283
|
3
|
|
|
|
|
24
|
my $search_url = URI->new("http://www.getty.edu/vow/TGNServlet"); |
|
284
|
3
|
|
|
|
|
8920
|
$search_url->query_param( 'english' => 'Y' ); |
|
285
|
3
|
|
|
|
|
490
|
$search_url->query_param( 'find' => $city ); |
|
286
|
3
|
|
|
|
|
363
|
$search_url->query_param( 'place' => undef ); |
|
287
|
3
|
|
|
|
|
426
|
$search_url->query_param( 'page' => 1 ); |
|
288
|
3
|
|
|
|
|
498
|
$search_url->query_param( 'nation' => $country ); |
|
289
|
|
|
|
|
|
|
|
|
290
|
3
|
|
|
|
|
574
|
my $request = HTTP::Request->new( 'GET', $search_url ); |
|
291
|
3
|
|
|
|
|
229
|
my $response = $ua->request($request); |
|
292
|
|
|
|
|
|
|
|
|
293
|
3
|
50
|
|
|
|
963920
|
if ( not $response->is_success ) { |
|
294
|
0
|
|
|
|
|
0
|
croak("WWW::Gazetteer::Getty: City $city in $country not found"); |
|
295
|
0
|
|
|
|
|
0
|
return; |
|
296
|
|
|
|
|
|
|
} |
|
297
|
|
|
|
|
|
|
|
|
298
|
3
|
|
|
|
|
44
|
my @cities; |
|
299
|
3
|
|
|
|
|
23
|
my $content = $response->content; |
|
300
|
|
|
|
|
|
|
|
|
301
|
3
|
|
|
|
|
412
|
my @bits = split /checkbox/, $content; |
|
302
|
|
|
|
|
|
|
|
|
303
|
3
|
|
|
|
|
8
|
my @ids; |
|
304
|
3
|
|
|
|
|
8
|
foreach my $bit (@bits) { |
|
305
|
63
|
|
|
|
|
285
|
my ($id) = $bit =~ m{subjectid=(\d+)}; |
|
306
|
63
|
100
|
|
|
|
141
|
next unless $id; |
|
307
|
51
|
|
|
|
|
121
|
push @ids, $id; |
|
308
|
|
|
|
|
|
|
} |
|
309
|
|
|
|
|
|
|
|
|
310
|
3
|
|
|
|
|
9
|
foreach my $id (@ids) { |
|
311
|
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
# http://www.getty.edu/vow/TGNFullDisplay?find=London&place=&nation=United+Kingdom&prev_page=1&english=Y&subjectid=7018906 |
|
313
|
51
|
|
|
|
|
378
|
my $detail_url = URI->new("http://www.getty.edu/vow/TGNFullDisplay"); |
|
314
|
51
|
|
|
|
|
5742
|
$detail_url->query_param( 'english' => 'Y' ); |
|
315
|
51
|
|
|
|
|
6653
|
$detail_url->query_param( 'find' => $city ); |
|
316
|
51
|
|
|
|
|
10917
|
$detail_url->query_param( 'place' => undef ); |
|
317
|
51
|
|
|
|
|
12129
|
$detail_url->query_param( 'page' => 1 ); |
|
318
|
51
|
|
|
|
|
16323
|
$detail_url->query_param( 'nation' => $country ); |
|
319
|
51
|
|
|
|
|
12406
|
$detail_url->query_param( 'subjectid' => $id ); |
|
320
|
|
|
|
|
|
|
|
|
321
|
51
|
|
|
|
|
13331
|
$request = HTTP::Request->new( 'GET', $detail_url ); |
|
322
|
51
|
|
|
|
|
3736
|
$response = $ua->request($request); |
|
323
|
|
|
|
|
|
|
|
|
324
|
51
|
50
|
|
|
|
9785717
|
if ( not $response->is_success ) { |
|
325
|
0
|
|
|
|
|
0
|
croak("WWW::Gazetteer::Getty: City $city in $country not found"); |
|
326
|
0
|
|
|
|
|
0
|
return; |
|
327
|
|
|
|
|
|
|
} |
|
328
|
|
|
|
|
|
|
|
|
329
|
51
|
|
|
|
|
906
|
$content = $response->content; |
|
330
|
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
# | Lat: 51.5000 decimal degrees |
|
332
|
|
|
|
|
|
|
# | Long: -0.0833 decimal degrees |
|
333
|
51
|
|
|
|
|
3307
|
my ($latitude) |
|
334
|
|
|
|
|
|
|
= $content |
|
335
|
|
|
|
|
|
|
=~ m{Lat:\s+([0-9.-]+) decimal degrees}; |
|
336
|
51
|
|
|
|
|
1091
|
my ($longitude) |
|
337
|
|
|
|
|
|
|
= $content |
|
338
|
|
|
|
|
|
|
=~ m{Long:\s+([0-9.-]+) decimal degrees}; |
|
339
|
|
|
|
|
|
|
|
|
340
|
51
|
|
|
|
|
489
|
push @cities, |
|
341
|
|
|
|
|
|
|
{ |
|
342
|
|
|
|
|
|
|
city => $city, |
|
343
|
|
|
|
|
|
|
country => $country, |
|
344
|
|
|
|
|
|
|
latitude => $latitude, |
|
345
|
|
|
|
|
|
|
longitude => $longitude, |
|
346
|
|
|
|
|
|
|
}; |
|
347
|
|
|
|
|
|
|
} |
|
348
|
3
|
50
|
|
|
|
104
|
return wantarray ? @cities : \@cities; |
|
349
|
|
|
|
|
|
|
} |
|
350
|
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
__END__ |