Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 54 lines (35 sloc) 0.835 kB
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
1 #GeoIP
2
157be20 @bbkr Fixed logo URL to match module name
authored
3 ![World](http://modules.perl6.org/logos/GeoIP.png)
2446365 @bbkr Logo shown in readme.
authored
4
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
5 Connect to MaxMind GeoIP database from Perl6.
6
7 ##INFO
8
9 This is just proof-of-concept, currently working only on Mac OS X with GeoLiteCity free database.
10
11 ##REQUIREMENTS
12
13 Install [NativeCall](https://github.com/jnthn/zavolaj).
14
15 Install GeoIP library and database from macports.
16
17 ```bash
18 sudo port install libgeoip GeoLiteCity
19 ```
20
21 ##USAGE
22
23 ```perl
24 use GeoIP;
25 my $g = GeoIP.new;
26
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, cou…
authored
27 say $g.country_code( '91.192.78.63' );
28 say $g.country_name( '91.192.78.63' );
29 say $g.continent_code( '91.192.78.63' );
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
30 ```
31
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, cou…
authored
32 If everything is installed correctly it should print:
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
33
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, cou…
authored
34 ```
35 PL
36 Poland
37 EU
38 ```
39
40 Using host names is also allowed:
41
42 ```perl
43 say $g.country_code( 'bbkr.org' );
44 ```
5b76fd2 @bbkr Proof-of-concept for native call interface
authored
45
46 ##TODO
47
48 Everything :)
4f4e2ad @bbkr Fixed crashing on not found record. Basic 3 method (country_name, cou…
authored
49
50 * other operating systems
51 * paid databases
52 * fetching whole record
53 * consistent interface
Something went wrong with that request. Please try again.