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

Geo::IPinfo - The official Perl library for IPinfo.

VERSION

Version 3.0.0 - Inlined the data files.

SYNOPSIS

Geo::IP The official Perl library for IPinfo. IPinfo prides itself on being the most reliable, accurate, and in-depth source of IP address data available anywhere. We process terabytes of data to produce our custom IP geolocation, company, carrier and IP type data sets. You can visit our developer docs at https://ipinfo.io/developers.

A quick usage example:

use Geo::IPinfo;

$access_token = '123456789abc';
$ipinfo = Geo::IPinfo->new($access_token);

$ip_address = '216.239.36.21';
$details = $ipinfo->info($ip_address);
$city = $details->city; # Emeryville
$loc = $details->loc; # 37.8342,-122.2900

SUBROUTINES/METHODS

new([token], [options])

Create an ipinfo object. The 'token' (string value) and 'options' (hash value) arguments are optional.

If 'token' is specified, then it's used to overcome the default non-commercial limitation of 1,000 request/day (For more details, see https://ipinfo.io/pricing)

if 'options' is specfied, the included values will allow control over cache policies and country name localization (For more details, see https://github.com/ipinfo/perl).

info(ip_address)

Returns a reference to a Details object containing all information related to the IP address. In case of errors, returns undef, the error message can be retrieved with the function 'error_msg()'

The values can be accessed with the named methods: ip, org, domains, privacy, abuse, timezone, hostname, city, country, country_name, country_flag, country_flag_url, country_currency, continent, is_eu, loc, latitude, longitude, postal, asn, company, meta, carrier, and all.

geo(ip_address)

Returns a reference to an object containing only the geolocation related data. Returns undef in case of errors, the error message can be retrieved with the function 'error_msg'

It's usually faster than getting the full response using 'info()'

The values returned are: ip, city, org, loc, latitude, longitude, hostname, is_eu, country, country_name, country_flag, country_flag_url, country_currency, meta, continent, postal, region, and timezone.

field(ip_address, field_name)

Returns a reference to an object containing only the field related data. Returns undef if the field is invalid

The possible values of 'field_name' are: ip, hostname, city, region, country, loc, org, postal, timezone, geo, asn, company, privacy, abuse, and domains.

error_msg( )

Returns a string containing the error message of the last operation, it returns an empty string if the last operation was successful

AUTHOR

Ben Dowling, <ben at ipinfo dot io>

BUGS

Please report any bugs or feature requests to bug-geo-ipinfo at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-IPinfo. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Geo::IPinfo

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2019 ipinfo.io.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.