From 4405bb0bce9149ddcb5e0299e3a0d058456fd2ff Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Mon, 9 Sep 2013 14:11:17 +0200 Subject: [PATCH] Fixed geonames_process.pl to issue an error if required files are not found --- data/geonames/geonames_process.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/geonames/geonames_process.pl b/data/geonames/geonames_process.pl index da1262a..a06ac7c 100644 --- a/data/geonames/geonames_process.pl +++ b/data/geonames/geonames_process.pl @@ -12,7 +12,7 @@ use XML::Writer; my %time_zones = (); my %countries = (); -open(TIMEZONES, 'timeZones.txt'); +open(TIMEZONES, 'timeZones.txt') or die("Cannot open timeZones.txt: $!\n"); while () { my ($country_code, $timezone_id, $gmt_offset_january, $gmt_offset_july, $gmt_offset_raw) = split(/\t/, $_); @@ -20,7 +20,7 @@ while () { } close(TIMEZONES); -open(COUNTRIES, 'countryInfo.txt'); +open(COUNTRIES, 'countryInfo.txt') or die("Cannot open timeZones.txt: $!\n"); while () { my ($country_code, $iso3, $iso_numeric, $fips, $name, $capital, $area, $population, $continent, $tld, $currency_code, $currency_name, $phone, $postal_code_format, $postal_code_regex, $languages, $geonameid, $neighbours, $equivalent_fips_code) = split(/\t/, $_); @@ -37,7 +37,7 @@ $writer->xmlDecl('utf-8'); $writer->startTag('geodata'); # TODO: process all files, not just HU.txt! -open(GEONAMES, "HU.txt"); +open(GEONAMES, "HU.txt") or die("Cannot open timeZones.txt: $!\n"); while () { my ($geonameid, $name, $asciiname, $alternatenames, $latitude, $longitude, $feature_class, $feature_code, $country_code, $alt_country_code, $admin1, $admin2, $admin3, $admin4, $population, $elevation, $dem, $timezone, $mod_date) = split(/\t/, $_);