Email-Abuse-Investigator
view release on metacpan or search on metacpan
lib/Email/Abuse/Investigator.pm view on Meta::CPAN
if($HAS_CONN_CACHE) {
my $conn_cache = LWP::ConnCache->new();
$conn_cache->total_capacity(10);
$ua->conn_cache($conn_cache);
}
$ua->env_proxy(1);
$self->{ua} = $ua;
}
# Use the ARIN RDAP endpoint; it covers the ARIN region and redirects
# for RIPE/APNIC/LACNIC/AfriNIC allocations.
my $res = eval { $ua->get("https://rdap.arin.net/registry/ip/$ip") };
return {} unless $res && $res->is_success();
my $j = $res->decoded_content();
my %info;
# Extract organisation name from the JSON response
if ($j =~ /"name"\s*:\s*"([^"]+)"/) { $info{org} = $1 }
if ($j =~ /"handle"\s*:\s*"([^"]+)"/) { $info{handle} = $1 }
( run in 0.475 second using v1.01-cache-2.11-cpan-524268b4103 )