The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

IP::Info - Interface to IP geographic and network data.

VERSION

Version 0.06

DESCRIPTION

Quova RESTful API provides the geographic location and network data for any Internet Protocol address in the public address space. The information includes:

  • Postal code, city, state, region, country, and continent

  • Area code (US and Canada only) and time zone

  • Longitude and latitude

  • DMA (Designated Market Area) and MSA (Metropolitan Statistical Area)

  • Network information, including type, speed, carrier, and registering organization

CONSTRUCTOR

The constructor requires the following parameters as listed below:

    +--------+----------+----------------------------------------+
    | Key    | Required | Description                            |
    +--------+----------+----------------------------------------+
    | apikey |   Yes    | API Key given by Quova.                |
    | secret |   Yes    | Allocated share secret given by Quova. |
    +--------+----------+----------------------------------------+

To obtain your Quova API key (apikey) and the shared secret, register your application here at http://developer.quova.com/

    use strict; use warnings;
    use IP::Info;

    my ($apikey, $secret, $info);
    $apikey = 'Your_API_Key';
    $secret = 'Your_shared_secret';
    $info   = IP::Info->new($apikey, $secret);
    # or
    $info   = IP::Info->new({ apikey => $apikey, secret => $secret});

METHODS

ipaddress()

If an IP address is specified in the correct format, then the call returns an object of type IP::Info::Response object which can be queried further to look for specific information for that IP.In case it encounters any error it will throw an exception of type HTTP::Exception. Also throw NoDataFoundException in case no data found for the given IP address.

The IP must be a standard, 32-bit IPv4 address. The allowed IP formats are

  • dot-decimal e.g. 4.2.2.2

  • decimal notation e.g. 67240450

    use strict; use warnings;
    use IP::Info;

    my $apikey = 'Your_API_Key';
    my $secret = 'Your_shared_secret';
    my $ipaddress = '4.2.2.2';
    my $info = IP::Info->new($apikey, $secret);
    eval {
        my $response = $info->ipaddress($ipaddress);
        print "Country: [".$response->country(). "]\n";
    };
    my $e = HTTP::Exception->caught;
    print "Error code: [".$e->code."]\n" if defined $e;

    $e = Exception::Class->caught('NoDataFoundException');
    print "NoDataFoundException caught.\n" if defined $e;

schema()

Saves the XML Schema Document in the given file (.xsd file). In case it encounters any error it will throw an exception of type HTTP::Exception. Also throw NoDataFoundException in case no data found.

    use strict; use warnings;
    use IP::Info;

    my $apikey = 'Your_API_Key';
    my $secret = 'Your_shared_secret';
    my $info   = IP::Info->new($apikey, $secret);
    eval { $info->schema('User_supplied_filename.xsd') };

    my $e = HTTP::Exception->caught;
    print "Error code: [".$e->code."]\n" if defined $e;

    $e = Exception::Class->caught('NoDataFoundException');
    print "NoDataFoundException caught.\n" if defined $e;

AUTHOR

Mohammad S Anwar, <mohammad.anwar at yahoo.com>

BUGS

Please report any bugs or feature requests to bug-ip-info at rt.cpan.org or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IP-Info. 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 IP::Info

You can also look for information at:

LICENSE AND COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

DISCLAIMER

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.