Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{{$NEXT}}

- Validation on the Int type used in the Metadata class has been loosened,
which should fix MaxMind::DB::Reader test failures on some platforms.


0.040000 2015-04-29

- Use Math::BigInt rather than Math::Int128 as part of working towards making
Expand Down
16 changes: 2 additions & 14 deletions lib/MaxMind/DB/Types.pm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ our @EXPORT_OK = qw(
);

sub Epoch () { $t }

sub Int () { $t }
}

{
Expand Down Expand Up @@ -135,20 +137,6 @@ our @EXPORT_OK = qw(
sub HashRefOfStr () { $t }
}

{
my $t = quote_sub(
q{
( defined $_[0] && !ref $_[0] && $_[0] =~ /^[0-9]+$/ )
or MaxMind::DB::Types::_confess(
'%s is not a valid integer',
$_[0]
);
}
);

sub Int () { $t }
}

{
my $t = _object_isa_type('MaxMind::DB::Metadata');

Expand Down
18 changes: 16 additions & 2 deletions t/MaxMind/DB/Metadata.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ use warnings;

use Test::More;

use Math::BigInt ();
use MaxMind::DB::Metadata;

my $metadata = MaxMind::DB::Metadata->new(
my %args = (
binary_format_major_version => 1,
binary_format_minor_version => 1,
build_epoch => time(),
Expand All @@ -16,6 +17,19 @@ my $metadata = MaxMind::DB::Metadata->new(
record_size => 32,
);

ok( $metadata, 'code compiles' );
{
my $metadata = MaxMind::DB::Metadata->new(%args);

ok( $metadata, 'code compiles' );
}

{
my $metadata = MaxMind::DB::Metadata->new(
%args,
binary_format_major_version => Math::BigInt->bone,
);

ok( $metadata, 'Math::BigInt works as Int in Metadata' );
}

done_testing();