{"id":18318552,"url":"https://github.com/maxmind/maxmind-db-reader-perl","last_synced_at":"2025-04-05T21:32:55.122Z","repository":{"id":9396403,"uuid":"11260309","full_name":"maxmind/MaxMind-DB-Reader-perl","owner":"maxmind","description":"Read MaxMind DB files and look up IP addresses","archived":false,"fork":false,"pushed_at":"2025-03-20T20:25:08.000Z","size":541,"stargazers_count":15,"open_issues_count":1,"forks_count":3,"subscribers_count":24,"default_branch":"main","last_synced_at":"2025-03-21T12:12:36.025Z","etag":null,"topics":["geoip","geoip2","maxmind","mmdb"],"latest_commit_sha":null,"homepage":"https://metacpan.org/release/MaxMind-DB-Reader/","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxmind.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-08T17:16:30.000Z","updated_at":"2025-02-14T20:21:05.000Z","dependencies_parsed_at":"2025-01-29T21:22:44.048Z","dependency_job_id":"7fa9e9f8-68a5-4821-850a-2ffe1e355182","html_url":"https://github.com/maxmind/MaxMind-DB-Reader-perl","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2FMaxMind-DB-Reader-perl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2FMaxMind-DB-Reader-perl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2FMaxMind-DB-Reader-perl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxmind%2FMaxMind-DB-Reader-perl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxmind","download_url":"https://codeload.github.com/maxmind/MaxMind-DB-Reader-perl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406079,"owners_count":20933803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geoip","geoip2","maxmind","mmdb"],"created_at":"2024-11-05T18:10:01.164Z","updated_at":"2025-04-05T21:32:54.780Z","avatar_url":"https://github.com/maxmind.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nMaxMind::DB::Reader - Read MaxMind DB files and look up IP addresses\n\n# VERSION\n\nversion 1.000014\n\n# SYNOPSIS\n\n    my $reader = MaxMind::DB::Reader-\u003enew( file =\u003e 'path/to/database.mmdb' );\n\n    my $record = $reader-\u003erecord_for_address('1.2.3.4');\n\n# DESCRIPTION\n\nThis module provides a low-level interface to the [MaxMind DB file\nformat](http://maxmind.github.io/MaxMind-DB/).\n\nIf you are looking for an interface to MaxMind's [GeoIP2 or GeoLite2\ndownloadable databases](http://dev.maxmind.com/geoip/), you should also check\nout the [GeoIP2](https://metacpan.org/pod/GeoIP2) distribution. That distribution provides a higher level OO\ninterface to those databases.\n\nThis API will work with any MaxMind DB databases, regardless of whether it is\na GeoIP2 database or not. In addition, if speed is critical, this API will\nalways be faster than the [GeoIP2](https://metacpan.org/pod/GeoIP2) modules, since it returns results as a raw\nPerl data structure rather than as an object.\n\n# PURE PERL VERSUS XS\n\nThe MaxMind-DB-Reader distribution ships with a single pure Perl\nimplementation of the Reader API. There is a separate distribution on CPAN,\n[MaxMind::DB::Reader::XS](https://metacpan.org/pod/MaxMind::DB::Reader::XS), that provides an XS implementation which links\nagainst [libmaxminddb](http://maxmind.github.io/libmaxminddb/).\n\nThe XS implementation is approximately 100 times faster than the pure Perl\nimplementation, so if speed is important to you, we highly recommend that you\ninstall it!\n\nIf you install the XS implementation it will be automatically loaded. You do\nnot need to change your code to take advantage of it.\n\n# API\n\nThis module provides the following API:\n\n## MaxMind::DB::Reader-\u003enew( file =\u003e $path )\n\nThis method returns a new reader object. Note that the class of the object\nreturned will actually be either [MaxMind::DB::Reader::PP](https://metacpan.org/pod/MaxMind::DB::Reader::PP) or\n[MaxMind::DB::Reader::XS](https://metacpan.org/pod/MaxMind::DB::Reader::XS).\n\nIf you need to check that an object is a valid reader, you should check that\nthe object does the `MaxMind::DB::Reader::Role::Reader` role.\n\nThe \"file\" parameter is a required attribute for the constructor. It must be a\nstring containing a path to a file. The constructor will die if the file\nprovided is not readable.\n\nYou can also pass an additional parameter, \"data\\_source\", which must be a valid\nfilehandle. This is useful in testing. For example, you can have the reader\nread from a filehandle opened to a scalar reference. Under normal usage, the\nreader simply opens the provided file to read from.\n\n## $reader-\u003erecord\\_for\\_address($ip\\_address)\n\nThis method takes an IPv4 or IPv6 address as a string. This can be either a\ndotted quad (`1.2.3.4`) or any valid IPv6 format (`abcd::1234`,\n`::1.2.3.4`, etc.).\n\nThis method will die if the address is not a valid IP address.\n\nThe method returns the data associated with the IP address. Depending on the\ncontents of the database, this can be a scalar or a reference to an array or\nhash.\n\n## $reader-\u003eiterate\\_search\\_tree( $data\\_callback, $node\\_callback )\n\nThis method iterates over the entire search tree, calling the callbacks you\nprovided for each data record and node in the tree.\n\nBoth callbacks are optional (although calling this with neither will do a lot\nof work for no good reason).\n\nThe node callback is called for every node in the database's search tree. This\ncallback is called with three arguments. These are the node's number (which is\nbased on its position in the file) and the values of its left and right\nrecords. These values are themselves numbers. See the [MaxMind DB\nspec](http://maxmind.github.io/MaxMind-DB/) for more details on what node\nrecord values mean.\n\nThe data callback is called for records that point to the database's data\nsection. The first two arguments identify the network that the data record\napplies to. The first argument is an IP address as an integer and the second\nis a network mask length. The final argument is the data associated with the\nnetwork.\n\n## $reader-\u003emetadata()\n\nThis method returns a [MaxMind::DB::Metadata](https://metacpan.org/pod/MaxMind::DB::Metadata) object for the database.\n\n## $reader-\u003efile()\n\nThis method returns the file path passed to the constructor.\n\n# VERSIONING POLICY\n\nThis module uses semantic versioning as described by\n[http://semver.org/](http://semver.org/). Version numbers can be read as X.YYYZZZ, where X is the\nmajor number, YYY is the minor number, and ZZZ is the patch number.\n\n# SUPPORT\n\nThis module is deprecated and will only receive fixes for major bugs and\nsecurity vulnerabilities. New features and functionality will not be added.\n\nPlease report all issues with this code using the GitHub issue tracker at\n[https://github.com/maxmind/MaxMind-DB-Reader-perl/issues](https://github.com/maxmind/MaxMind-DB-Reader-perl/issues).\n\nBugs may be submitted through [https://github.com/maxmind/MaxMind-DB-Reader-perl/issues](https://github.com/maxmind/MaxMind-DB-Reader-perl/issues).\n\n# AUTHORS\n\n- Dave Rolsky \u003cdrolsky@maxmind.com\u003e\n- Olaf Alders \u003coalders@maxmind.com\u003e\n\n# CONTRIBUTORS\n\n- Greg Oschwald \u003cgoschwald@maxmind.com\u003e\n- Mark Fowler \u003cmark@twoshortplanks.com\u003e\n- Mateu X Hunter \u003cmhunter@maxmind.com\u003e\n- Ran Eilam \u003creilam@maxmind.com\u003e\n- William Stevenson \u003cskyblue@skybluecircles.com\u003e\n- Will Storey \u003cwstorey@maxmind.com\u003e\n\n# COPYRIGHT AND LICENSE\n\nThis software is Copyright (c) 2019 by MaxMind, Inc.\n\nThis is free software, licensed under:\n\n    The Artistic License 2.0 (GPL Compatible)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmind%2Fmaxmind-db-reader-perl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxmind%2Fmaxmind-db-reader-perl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxmind%2Fmaxmind-db-reader-perl/lists"}