Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
MaxMind GeoIP support for Perl6
Perl6
Branch: master

Merge pull request #6 from paultcochrane/pr/fix-vm-config-lookup

Fix $*VM config information lookup
latest commit 2e396f4399
@bbkr authored

README.md

GeoIP City

Connect to MaxMind GeoIP City databases.

Compatible with Perl 6 Rakudo 2013.02+,

REQUIREMENTS

Ubuntu Linux

  • In terminal enter sudo apt-get install libgeoip1 geoip-database-contrib

Mac OS X

  • Install MacPorts.
  • In terminal enter sudo port install libgeoip GeoLiteCity.
  • Add DYLD_LIBRARY_PATH=/opt/local/lib to your ~/.profile and relog.

Microsoft Windows

?

Other systems

USAGE

    use GeoIP::City;

    my $geo = GeoIP::City.new;

    say $geo.locate( 'perl.org' );
    say $geo.locate( '207.171.7.63' );

In both cases it should print following Hash:

    {
        "area_code" => 310,
        "city" => "Beverly Hills",
        "continent_code" => "NA",
        "country" => "United States",
        "country_code" => "US",
        "dma_code" => 803,
        "latitude" => "34.074902",
        "longitude" => "-118.399696",
        "postal_code" => "90209",
        "region" => "California",
        "region_code" => "CA",
        "time_zone" => "America/Los_Angeles"
    }

Precision of response and amount of its fields may vary.

Nil is returned if location is not found.

Paid databases

If you own paid database you can provide its location.

    my $geo = GeoIP::City.new( '/Users/bbkr/GeoIPCity.dat' );

Info

You can get version and date of used database.

    say $geo.info;

Will print.

    GEO-533LITE 20110501 Build 1 Copyright (c) 2011 MaxMind Inc All Rights Reserved

LICENSE

Released under Artistic License 2.0.

CONTACT

You can find me (and many awesome people who helped me to develop this module) on irc.freenode.net #perl6 channel as bbkr.

Something went wrong with that request. Please try again.