logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

IP::Geolocation::MMDB::Metadata - Metadata from a MaxMind DB file

Author

       Andreas Vögele <voegelas@cpan.org>

Bugs And Limitations

       None known.

Configuration And Environment

       None.

Dependencies

       None.

Description

       A class for metadata from a MaxMind DB file.

Diagnostics

       None.

Incompatibilities

       None.

Name

       IP::Geolocation::MMDB::Metadata - Metadata from a MaxMind DB file

See Also

       IP::Geolocation::MMDB

Subroutines/Methods

new
         my $metadata = IP::Geolocation::MMDB::Metadata->new(
           binary_format_major_version => 2,
           binary_format_minor_version => 0,
           build_epoch   => time,
           database_type => 'City',
           languages     => [qw(en fr pt-BR)],
           description   => {
             en => 'IP to city',
             fr => 'IP vers ville',
           },
           ip_version    => 6,
           node_count    => 3829268,
           record_size   => 28,
         );

       Returns a new metadata object.

   binary_format_major_version
         my $major_version = $metadata->binary_format_major_version;

       Returns the database format's major version number.

   binary_format_minor_version
         my $minor_version = $metadata->binary_format_minor_version;

       Returns the database format's minor version number.

   build_epoch
         my $t = gmtime $metadata->build_epoch;

       Returns the database's build timestamp as an epoch number.

   database_type
         my $database_type = $metadata->database_type;

       Returns a free-form string indicating the database type.

   languages
         for my $language (@{$metadata->languages}) {
           say $language;
         }

       Returns a reference to an array of locale codes indicating what languages this database has information
       for.

   description
         my %description_for = %{$metadata->description};
         for my $language (keys %description_for) {
           my $description = $description_for{$language};
           say "$language: $description";
         }

       Returns a reference to a hash that maps locale codes to strings that describe the database content.

   ip_version
         my $ip_version = $metadata->ip_version;

       Returns 4 or 6.

   node_count
         my $node_count = $metadata->node_count;

       Returns the number of nodes in the database's search tree.

   record_size
         my $record_size = $metadata->record_size;

       Returns the record size for nodes in the database's search tree.

Synopsis

         use IP::Geolocation::MMDB;
         my $db = IP::Geolocation::MMDB->new(file => '/path/to/City.mmdb');
         my $metadata = $db->metadata;

Version

       version 1.013

See Also