darren chamberlain wrote:

One thing I'd add if you do decide to use the Geo::IP module, it does not behave as documented if it does not find a match. The docs say it returns "undef", but in fact it returns the string "--". The attached patch fixes that problem. I've sent the patch to the GeoIP folks, and got no reply. I'll try sending it to [EMAIL PROTECTED] and see if someone gets it that way :).

Mike
Index: IP.xs
===================================================================
RCS file: /usr/local/cvsroot/gkgnsi-support/src/Geo-IP/IP.xs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- IP.xs       22 Aug 2002 20:30:43 -0000      1.1
+++ IP.xs       22 Aug 2002 20:32:55 -0000      1.2
@@ -39,8 +39,14 @@
 country_code_by_addr(gi, addr)
        GeoIP *gi
        char * addr
+    PREINIT:
+    char * code;
     CODE:
-       RETVAL = (char *)GeoIP_country_code_by_addr(gi,addr);
+       code = (char *)GeoIP_country_code_by_addr(gi,addr);
+    if (*code == '-')
+        RETVAL = NULL;
+    else   
+        RETVAL = code;
     OUTPUT:
        RETVAL
 


Reply via email to