The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Acme::Free::API::Geodata::GeoIP - Lookup GeoIP data for an IP address

SYNOPSIS

  use Acme::Free::API::Geodata::GeoIP;
  
  my $agent = Acme::Free::API::Geodata::GeoIP->new(debug => 1);

  my $geodata = $agent->lookup('24.48.0.1');

  if(!defined($geodata)) {
      die("Lookup failed");
  }

  print "$ip is hosted by ", $geodata->{org}, " in ", $geodata->{city}, " (", $geodata->{country}, ")\n";

DESCRIPTION

This module looks up GeoIP data through a public API, see https://www.freepublicapis.com/ip-geolocation-api.

It returns a hashref on success, undefined on failure. To see what went wrong, set debug to a true value in new().

SEE ALSO

Call for API implementations on PerlMonks: https://perlmonks.org/?node_id=11161472

AUTHOR

Rene Schickbauer, <cavac@cpan.org>

SOURCECODE

Source code is available on my mercurial repo: https://cavac.at/public/mercurial/Acme-Free-API-Geodata-GeoIP/

And no, i do NOT use GitHub for my projects, so don't ask.

COPYRIGHT AND LICENSE

Copyright (C) 2024 by Rene Schickbauer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.38.2 or, at your option, any later version of Perl 5 you may have available.