IP-World

 view release on metacpan or  search on metacpan

script/maint_ip_world_db  view on Meta::CPAN


# create the user-agent object via the package at the start of this file
my $ua = LWP::UserAgent->new (timeout => 30);
# MaxMind occasionally block LWP::UserAgent's default User-Agent header,
# but I've been told that they don't mind if we lie. This one taken from
# a real browser during one of those outages worked OK
#    -- DCANTRELL
$ua->agent('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36');

# only proxy handling is via environment variables
if ($ENV{http_proxy} || $ENV{HTTP_PROXY}) {$ua->env_proxy}

# if we have a file already, get mod times of the data sources
my $latestMod = 0;
if ($replfn_exists) {
  for my $url (@URLS) {
    $resp = $ua->head($url);
    if (!$resp->is_success) {
      die "Source file $url could not be found: ".status_message($resp->code);
    }
    $_ = $resp->last_modified;



( run in 1.235 second using v1.01-cache-2.11-cpan-71847e10f99 )