Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 91 lines (59 sloc) 1.971 kb
0b53e74 @bbkr GeoIP City paid and free supported.
authored
1 #GeoIP City
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
2
0b53e74 @bbkr GeoIP City paid and free supported.
authored
3 Connect to [MaxMind](http://www.maxmind.com/en/home) GeoIP City databases.
2446365 @bbkr Logo shown in readme.
authored
4
0b53e74 @bbkr GeoIP City paid and free supported.
authored
5 Compatible with Perl 6 [Rakudo](http://rakudo.org/) 2013.02+,
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
6
0b53e74 @bbkr GeoIP City paid and free supported.
authored
7 ##REQUIREMENTS
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
8
0b53e74 @bbkr GeoIP City paid and free supported.
authored
9 ####Ubuntu Linux
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
10
9596058 @bbkr Fixed Ubuntu package name.
authored
11 * In terminal enter `sudo apt-get install libgeoip1 geoip-database-contrib`
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
12
0b53e74 @bbkr GeoIP City paid and free supported.
authored
13 ####Mac OS X
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
14
0b53e74 @bbkr GeoIP City paid and free supported.
authored
15 * Install [MacPorts](http://www.macports.org/).
16 * In terminal enter `sudo port install libgeoip GeoLiteCity`.
17 * Add `DYLD_LIBRARY_PATH=/opt/local/lib` to your `~/.profile` and relog.
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
18
0b53e74 @bbkr GeoIP City paid and free supported.
authored
19 ####Microsoft Windows
20
21 ?
22
23 ####Other systems
24
25 * Follow [installation instructions](http://www.maxmind.com/en/installation?city=1) from MaxMind.
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
26
27 ##USAGE
28
29 ```perl
0b53e74 @bbkr GeoIP City paid and free supported.
authored
30 use GeoIP::City;
31
32 my $geo = GeoIP::City.new;
33
47a154c @bbkr Fixed Segmentation fault on missing record fields.
authored
34 say $geo.locate( 'perl.org' );
35 say $geo.locate( '207.171.7.63' );
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
36 ```
37
0b53e74 @bbkr GeoIP City paid and free supported.
authored
38 In both cases it should print following Hash:
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
39
0b53e74 @bbkr GeoIP City paid and free supported.
authored
40 ```perl
41 {
47a154c @bbkr Fixed Segmentation fault on missing record fields.
authored
42 "area_code" => 310,
43 "city" => "Beverly Hills",
44 "continent_code" => "NA",
45 "country" => "United States",
46 "country_code" => "US",
47 "dma_code" => 803,
48 "latitude" => "34.074902",
49 "longitude" => "-118.399696",
50 "postal_code" => "90209",
51 "region" => "California",
52 "region_code" => "CA",
53 "time_zone" => "America/Los_Angeles"
0b53e74 @bbkr GeoIP City paid and free supported.
authored
54 }
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, countr...
authored
55 ```
0b53e74 @bbkr GeoIP City paid and free supported.
authored
56
47a154c @bbkr Fixed Segmentation fault on missing record fields.
authored
57 Precision of response and amount of its fields may vary.
58
59 `Nil` is returned if location is not found.
60
0b53e74 @bbkr GeoIP City paid and free supported.
authored
61 ###Paid databases
62
63 If you own [paid database](http://www.maxmind.com/en/city) you can provide its location.
64
65 ```perl
66 my $geo = GeoIP::City.new( '/Users/bbkr/GeoIPCity.dat' );
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, countr...
authored
67 ```
68
0b53e74 @bbkr GeoIP City paid and free supported.
authored
69 ###Info
70
71 You can get version and date of used database.
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, countr...
authored
72
73 ```perl
0b53e74 @bbkr GeoIP City paid and free supported.
authored
74 say $geo.info;
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, countr...
authored
75 ```
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
76
0b53e74 @bbkr GeoIP City paid and free supported.
authored
77 Will print.
78
79 ```
80 GEO-533LITE 20110501 Build 1 Copyright (c) 2011 MaxMind Inc All Rights Reserved
81 ```
82
83 ## LICENSE
84
85 Released under [Artistic License 2.0](http://www.perlfoundation.org/artistic_license_2_0).
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
86
0b53e74 @bbkr GeoIP City paid and free supported.
authored
87 ## CONTACT
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, countr...
authored
88
0b53e74 @bbkr GeoIP City paid and free supported.
authored
89 You can find me (and many awesome people who helped me to develop this module)
90 on irc.freenode.net #perl6 channel as **bbkr**.
Something went wrong with that request. Please try again.