line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MaxMind::DB::Metadata; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
31439
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
62
|
|
5
|
2
|
|
|
2
|
|
935
|
use namespace::autoclean; |
|
2
|
|
|
|
|
29855
|
|
|
2
|
|
|
|
|
9
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.040001'; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1056
|
use Moo; |
|
2
|
|
|
|
|
13795
|
|
|
2
|
|
|
|
|
11
|
|
10
|
2
|
|
|
2
|
|
2863
|
use MaxMind::DB::Types qw( ArrayRefOfStr Epoch HashRefOfStr Int Str ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
129
|
|
11
|
2
|
|
|
2
|
|
785
|
use MooX::StrictConstructor; |
|
2
|
|
|
|
|
18390
|
|
|
2
|
|
|
|
|
8
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'MaxMind::DB::Role::Debugs'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
my %metadata = ( |
17
|
|
|
|
|
|
|
binary_format_major_version => Int, |
18
|
|
|
|
|
|
|
binary_format_minor_version => Int, |
19
|
|
|
|
|
|
|
build_epoch => Epoch, |
20
|
|
|
|
|
|
|
database_type => Str, |
21
|
|
|
|
|
|
|
description => HashRefOfStr, |
22
|
|
|
|
|
|
|
ip_version => Int, |
23
|
|
|
|
|
|
|
node_count => Int, |
24
|
|
|
|
|
|
|
record_size => Int, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
for my $attr ( keys %metadata ) { |
28
|
|
|
|
|
|
|
has $attr => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => $metadata{$attr}, |
31
|
|
|
|
|
|
|
required => 1, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has languages => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
isa => ArrayRefOfStr, |
39
|
|
|
|
|
|
|
default => sub { [] }, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub metadata_to_encode { |
43
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my %metadata; |
46
|
0
|
|
|
|
|
|
foreach my $attr ( $self->meta()->get_all_attributes() ) { |
47
|
0
|
|
|
|
|
|
my $method = $attr->name; |
48
|
0
|
|
|
|
|
|
$metadata{$method} = $self->$method; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return \%metadata; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub debug_dump { |
55
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
|
$self->_debug_newline(); |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$self->_debug_message('Metadata:'); |
60
|
0
|
|
|
|
|
|
my $version = join '.', |
61
|
|
|
|
|
|
|
$self->binary_format_major_version(), |
62
|
|
|
|
|
|
|
$self->binary_format_minor_version(); |
63
|
0
|
|
|
|
|
|
$self->_debug_string( ' Binary format version', $version ); |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
require DateTime; |
66
|
0
|
|
|
|
|
|
$self->_debug_string( |
67
|
|
|
|
|
|
|
' Build epoch', |
68
|
|
|
|
|
|
|
$self->build_epoch() . ' (' |
69
|
|
|
|
|
|
|
. DateTime->from_epoch( epoch => $self->build_epoch() ) . ')' |
70
|
|
|
|
|
|
|
); |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->_debug_string( ' Database type', $self->database_type() ); |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my $description = $self->description(); |
75
|
0
|
|
|
|
|
|
for my $locale ( sort keys %{$description} ) { |
|
0
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
$self->_debug_string( |
77
|
|
|
|
|
|
|
" Description [$locale]", |
78
|
0
|
|
|
|
|
|
$description->{$locale} |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$self->_debug_string( ' IP version', $self->ip_version() ); |
83
|
0
|
|
|
|
|
|
$self->_debug_string( ' Node count', $self->node_count() ); |
84
|
0
|
|
|
|
|
|
$self->_debug_string( ' Record size (in bits)', $self->record_size() ); |
85
|
|
|
|
|
|
|
$self->_debug_string( |
86
|
|
|
|
|
|
|
' Languages', join ', ', |
87
|
0
|
|
|
|
|
|
@{ $self->languages() } |
|
0
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
); |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
#ABSTRACT: A class for metadata related to a MaxMind DB database |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |