| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MaxMind::DB::Common; |
|
2
|
|
|
|
|
|
|
$MaxMind::DB::Common::VERSION = '0.031003'; |
|
3
|
1
|
|
|
1
|
|
24789
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
47
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
59
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# This is a hack to let us test code that requires a specific |
|
7
|
|
|
|
|
|
|
# MaxMind::DB::Common version against the MaxMind-DB-Common git repo code, but |
|
8
|
|
|
|
|
|
|
# without actually setting the $VERSION variable. |
|
9
|
|
|
|
|
|
|
BEGIN { |
|
10
|
1
|
50
|
|
1
|
|
29
|
$MaxMind::DB::Common::{VERSION} = \99 |
|
11
|
|
|
|
|
|
|
unless exists $MaxMind::DB::Common::{VERSION}; |
|
12
|
|
|
|
|
|
|
} |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $separator_size; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
BEGIN { |
|
17
|
1
|
|
|
1
|
|
160
|
$separator_size = 16; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use constant { |
|
21
|
1
|
|
|
|
|
150
|
LEFT_RECORD => 0, |
|
22
|
|
|
|
|
|
|
RIGHT_RECORD => 1, |
|
23
|
|
|
|
|
|
|
DATA_SECTION_SEPARATOR_SIZE => $separator_size, |
|
24
|
|
|
|
|
|
|
DATA_SECTION_SEPARATOR => ( "\0" x $separator_size ), |
|
25
|
|
|
|
|
|
|
METADATA_MARKER => "\xab\xcd\xefMaxMind.com", |
|
26
|
1
|
|
|
1
|
|
7
|
}; |
|
|
1
|
|
|
|
|
9
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
1
|
|
|
1
|
|
6
|
use Exporter qw( import ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
146
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our %TypeNumToName = ( |
|
31
|
|
|
|
|
|
|
0 => 'extended', |
|
32
|
|
|
|
|
|
|
1 => 'pointer', |
|
33
|
|
|
|
|
|
|
2 => 'utf8_string', |
|
34
|
|
|
|
|
|
|
3 => 'double', |
|
35
|
|
|
|
|
|
|
4 => 'bytes', |
|
36
|
|
|
|
|
|
|
5 => 'uint16', |
|
37
|
|
|
|
|
|
|
6 => 'uint32', |
|
38
|
|
|
|
|
|
|
7 => 'map', |
|
39
|
|
|
|
|
|
|
8 => 'int32', |
|
40
|
|
|
|
|
|
|
9 => 'uint64', |
|
41
|
|
|
|
|
|
|
10 => 'uint128', |
|
42
|
|
|
|
|
|
|
11 => 'array', |
|
43
|
|
|
|
|
|
|
12 => 'container', |
|
44
|
|
|
|
|
|
|
13 => 'end_marker', |
|
45
|
|
|
|
|
|
|
14 => 'boolean', |
|
46
|
|
|
|
|
|
|
15 => 'float', |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
our %TypeNameToNum = reverse %TypeNumToName; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
|
52
|
|
|
|
|
|
|
LEFT_RECORD |
|
53
|
|
|
|
|
|
|
RIGHT_RECORD |
|
54
|
|
|
|
|
|
|
DATA_SECTION_SEPARATOR_SIZE |
|
55
|
|
|
|
|
|
|
DATA_SECTION_SEPARATOR |
|
56
|
|
|
|
|
|
|
METADATA_MARKER |
|
57
|
|
|
|
|
|
|
%TypeNumToName |
|
58
|
|
|
|
|
|
|
%TypeNameToNum |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# ABSTRACT: Code shared by the MaxMind DB reader and writer modules |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=pod |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 NAME |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
MaxMind::DB::Common - Code shared by the MaxMind DB reader and writer modules |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 VERSION |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
version 0.031003 |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This distribution provides some shared code for use by both the MaxMind DB |
|
80
|
|
|
|
|
|
|
reader and writer Perl modules. |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
For now, the only piece documented for public consumption is |
|
83
|
|
|
|
|
|
|
L<MaxMind::DB::Metadata>. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 VERSIONING POLICY |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This module uses semantic versioning as described by |
|
88
|
|
|
|
|
|
|
L<http://semver.org/>. Version numbers can be read as X.YYYZZZ, where X is the |
|
89
|
|
|
|
|
|
|
major number, YYY is the minor number, and ZZZ is the patch number. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 SUPPORT |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Please report all issues with this code using the GitHub issue tracker at |
|
94
|
|
|
|
|
|
|
L<https://github.com/maxmind/MaxMind-DB-Common-perl/issues>. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 AUTHORS |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Dave Rolsky <drolsky@maxmind.com> |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Olaf Alders <oalders@maxmind.com> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=back |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by MaxMind, Inc.. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This is free software, licensed under: |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |