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

WebService::GeoIPify - Perl library for ipify's Geolocation API, https://geo.ipify.org.

SYNOPSIS

  use WebService::GeoIPify;

  my $geoipify = WebService::GeoIPify->new(api_key => '1xxxxxxxxxxxxxxxxxxxxxxxxxxxxx32');
  print $geoipify->lookup('8.8.8.8');

DESCRIPTION

WebService::GeoIPify is a Perl library for obtaining Geolocation information on IPv4 address.

DEVELOPMENT

Source repo at https://github.com/kianmeng/webservice-geoipify.

How to contribute? Follow through the CONTRIBUTING.md document to setup your development environment.

METHODS

new($api_key)

Construct a new WebService::GeoIPify instance.

  my $geoipify = WebService::GeoIPify->new(api_key => '1xxxxxxxxxxxxxxxxxxxxxxxxxxxxx32');

api_key

Compulsory. The API access key used to make request through web service.

api_url

The default base URL for API calls.

api_ipify_url

The default base URL for ipify API calls to obtain the client public IP.

cache

The Least Recently Used (LRU) memory caching storage used to cache IP address record. The cache will only stored most recent 500 records.

lookup($ip_address)

Query and get an IP address information. Only accept IPv4 public address.

    my $geoipify = WebService::GeoIPify->new(api_key => '1xxxxxxxxxxxxxxxxxxxxxxxxxxxxx32');
    print $geoipify->lookup('8.8.8.8');

check()

Look up the public IP address of the client which made the web service call.

    my $geoipify = WebService::GeoIPify->new(api_key => '1xxxxxxxxxxxxxxxxxxxxxxxxxxxxx32');
    print $geoipify->check();

COPYRIGHT AND LICENSE

This software is Copyright (c) 2019 Kian Meng, Ang.

This is free software, licensed under:

    The Artistic License 2.0 (GPL Compatible)

AUTHOR

Kian Meng, Ang <kianmeng@users.noreply.github.com>