@@ -3,10 +3,11 @@ use warnings;
use Module::Build;
-# If you don't support 64-bit pack formats you will have a bad time and will
-# not talk to Cassandra today
+my %also_requires;
+
+# If you don't support 64-bit pack formats natively you will need Math::Int64
eval { pack( "q>", 1 ) eq "\0\0\0\0\0\0\0\1" } or
- die "OS unsupported - no 64bit integers";
+ $also_requires{"Math::Int64"} = 0;
my $build = Module::Build->new(
module_name => 'Protocol::CassandraCQL',
@@ -15,13 +16,18 @@ my $build = Module::Build->new(
'Encode' => 0,
'Math::BigInt' => 0,
'IO::Socket::IP' => 0,
+ 'Socket' => '1.82', # inet_pton
+ %also_requires,
},
- build_requires => {
+ test_requires => {
'Test::HexString' => 0,
'Test::Fatal' => 0,
'Test::More' => '0.88', # done_testing
},
- auto_configure_requires => 0, # Don't add M::B to configure_requires
+ configure_requires => {
+ 'Module::Build' => '0.4004', # test_requires
+ },
+ dynamic_config => 1,
license => 'perl',
create_makefile_pl => 'small', # since we do active testing here
create_license => 1,
@@ -1,5 +1,10 @@
Revision history for Protocol-CassandraCQL
+0.12 2014/12/18 15:33:09
+ [CHANGES]
+ * Support 64bit-challenged machines by using Math::Int64 to
+ implement the 64bit-integer types
+
0.11 2014/02/07 21:07:37
[CHANGES]
* Renamed ColumnMeta->metadata_defined to ->has_metadata
@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -4,7 +4,7 @@
"Paul Evans <leonerd@leonerd.org.uk>"
],
"dynamic_config" : 1,
- "generated_by" : "Module::Build version 0.4203",
+ "generated_by" : "Module::Build version 0.421",
"license" : [
"perl_5"
],
@@ -14,11 +14,9 @@
},
"name" : "Protocol-CassandraCQL",
"prereqs" : {
- "build" : {
+ "configure" : {
"requires" : {
- "Test::Fatal" : "0",
- "Test::HexString" : "0",
- "Test::More" : "0.88"
+ "Module::Build" : "0.4004"
}
},
"runtime" : {
@@ -26,38 +24,46 @@
"Compress::Snappy" : "0",
"Encode" : "0",
"IO::Socket::IP" : "0",
- "Math::BigInt" : "0"
+ "Math::BigInt" : "0",
+ "Socket" : "1.82"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "Test::Fatal" : "0",
+ "Test::HexString" : "0",
+ "Test::More" : "0.88"
}
}
},
"provides" : {
"Protocol::CassandraCQL" : {
"file" : "lib/Protocol/CassandraCQL.pm",
- "version" : "0.11"
+ "version" : "0.12"
},
"Protocol::CassandraCQL::Client" : {
"file" : "lib/Protocol/CassandraCQL/Client.pm",
- "version" : "0.11"
+ "version" : "0.12"
},
"Protocol::CassandraCQL::ColumnMeta" : {
"file" : "lib/Protocol/CassandraCQL/ColumnMeta.pm",
- "version" : "0.11"
+ "version" : "0.12"
},
"Protocol::CassandraCQL::Frame" : {
"file" : "lib/Protocol/CassandraCQL/Frame.pm",
- "version" : "0.11"
+ "version" : "0.12"
},
"Protocol::CassandraCQL::Frames" : {
"file" : "lib/Protocol/CassandraCQL/Frames.pm",
- "version" : "0.11"
+ "version" : "0.12"
},
"Protocol::CassandraCQL::Result" : {
"file" : "lib/Protocol/CassandraCQL/Result.pm",
- "version" : "0.11"
+ "version" : "0.12"
},
"Protocol::CassandraCQL::Type" : {
"file" : "lib/Protocol/CassandraCQL/Type.pm",
- "version" : "0.11"
+ "version" : "0.12"
},
"Protocol::CassandraCQL::Type::ASCII" : {
"file" : "lib/Protocol/CassandraCQL/Type.pm"
@@ -123,5 +129,5 @@
"http://dev.perl.org/licenses/"
]
},
- "version" : "0.11"
+ "version" : "0.12"
}
@@ -3,38 +3,40 @@ abstract: 'wire protocol support functions for Cassandra CQL'
author:
- 'Paul Evans <leonerd@leonerd.org.uk>'
build_requires:
- Test::Fatal: 0
- Test::HexString: 0
- Test::More: 0.88
+ Test::Fatal: '0'
+ Test::HexString: '0'
+ Test::More: '0.88'
+configure_requires:
+ Module::Build: '0.4004'
dynamic_config: 1
-generated_by: 'Module::Build version 0.4203, CPAN::Meta::Converter version 2.133380'
+generated_by: 'Module::Build version 0.421, CPAN::Meta::Converter version 2.142690'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Protocol-CassandraCQL
provides:
Protocol::CassandraCQL:
file: lib/Protocol/CassandraCQL.pm
- version: 0.11
+ version: '0.12'
Protocol::CassandraCQL::Client:
file: lib/Protocol/CassandraCQL/Client.pm
- version: 0.11
+ version: '0.12'
Protocol::CassandraCQL::ColumnMeta:
file: lib/Protocol/CassandraCQL/ColumnMeta.pm
- version: 0.11
+ version: '0.12'
Protocol::CassandraCQL::Frame:
file: lib/Protocol/CassandraCQL/Frame.pm
- version: 0.11
+ version: '0.12'
Protocol::CassandraCQL::Frames:
file: lib/Protocol/CassandraCQL/Frames.pm
- version: 0.11
+ version: '0.12'
Protocol::CassandraCQL::Result:
file: lib/Protocol/CassandraCQL/Result.pm
- version: 0.11
+ version: '0.12'
Protocol::CassandraCQL::Type:
file: lib/Protocol/CassandraCQL/Type.pm
- version: 0.11
+ version: '0.12'
Protocol::CassandraCQL::Type::ASCII:
file: lib/Protocol/CassandraCQL/Type.pm
Protocol::CassandraCQL::Type::BIGINT:
@@ -74,10 +76,11 @@ provides:
Protocol::CassandraCQL::Type::VARINT:
file: lib/Protocol/CassandraCQL/Type.pm
requires:
- Compress::Snappy: 0
- Encode: 0
- IO::Socket::IP: 0
- Math::BigInt: 0
+ Compress::Snappy: '0'
+ Encode: '0'
+ IO::Socket::IP: '0'
+ Math::BigInt: '0'
+ Socket: '1.82'
resources:
license: http://dev.perl.org/licenses/
-version: 0.11
+version: '0.12'
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.4203
+# Note: this file was auto-generated by Module::Build::Compat version 0.4210
use Module::Build::Compat 0.02;
Module::Build::Compat->run_build_pl(args => \@ARGV);
@@ -72,9 +72,6 @@ TODO
* Reimplement Protocol::CassandraCQL::Frame in XS code for better
performance.
- * Support 64bit-challenged perls by using `Math::BigInt' for 64bit
- values
-
SPONSORS
This code was paid for by
@@ -8,7 +8,7 @@ package Protocol::CassandraCQL::Client;
use strict;
use warnings;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use base qw( IO::Socket::IP );
@@ -8,7 +8,7 @@ package Protocol::CassandraCQL::ColumnMeta;
use strict;
use warnings;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use Carp;
@@ -8,7 +8,7 @@ package Protocol::CassandraCQL::Frame;
use strict;
use warnings;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use Carp;
@@ -8,7 +8,7 @@ package Protocol::CassandraCQL::Frames;
use strict;
use warnings;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use Exporter 'import';
our @EXPORT_OK = qw(
@@ -9,7 +9,7 @@ use strict;
use warnings;
use base qw( Protocol::CassandraCQL::ColumnMeta );
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use Carp;
@@ -8,7 +8,7 @@ package Protocol::CassandraCQL::Type;
use strict;
use warnings;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use Carp;
@@ -17,6 +17,8 @@ use Encode ();
use Protocol::CassandraCQL qw( :types );
use Protocol::CassandraCQL::Frame; # collection types use it for encoding/decoding
+use constant HAVE_INT64 => eval { pack( "q>", 1 ) eq "\0\0\0\0\0\0\0\1" };
+
=head1 NAME
C<Protocol::CassandraCQL::Type> - represents a Cassandra CQL data type
@@ -146,8 +148,15 @@ sub decode { $_[1] }
# 64-bit integer
package Protocol::CassandraCQL::Type::BIGINT;
use base qw( Protocol::CassandraCQL::Type::_integral );
-sub encode { pack "q>", $_[1] }
-sub decode { unpack "q>", $_[1] }
+if( Protocol::CassandraCQL::Type::HAVE_INT64 ) {
+ *encode = sub { pack "q>", $_[1] };
+ *decode = sub { unpack "q>", $_[1] };
+}
+else {
+ require Math::Int64;
+ *encode = sub { Math::Int64::int64_to_net( $_[1] ) };
+ *decode = sub { Math::Int64::net_to_int64( $_[1] ) };
+}
# blob
package Protocol::CassandraCQL::Type::BLOB;
@@ -217,8 +226,15 @@ use base qw( Protocol::CassandraCQL::Type::VARCHAR );
# miliseconds since UNIX epoch as 64bit uint
package Protocol::CassandraCQL::Type::TIMESTAMP;
use base qw( Protocol::CassandraCQL::Type::_integral );
-sub encode { pack "Q>", ($_[1] * 1000) }
-sub decode { (unpack "Q>", $_[1]) / 1000 }
+if( Protocol::CassandraCQL::Type::HAVE_INT64 ) {
+ *encode = sub { pack "Q>", ($_[1] * 1000) };
+ *decode = sub { (unpack "Q>", $_[1]) / 1000 };
+}
+else {
+ require Math::Int64;
+ *encode = sub { Math::Int64::uint64_to_net( $_[1] * 1000 ) };
+ *decode = sub { (Math::Int64::net_to_uint64( $_[1] )) / 1000 };
+}
# UUID is just a hex string - accept 32 hex digits, hypens optional
package Protocol::CassandraCQL::Type::UUID;
@@ -8,7 +8,7 @@ package Protocol::CassandraCQL;
use strict;
use warnings;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
use Exporter 'import';
our @EXPORT_OK = qw(
@@ -280,10 +280,6 @@ sub typename
Reimplement L<Protocol::CassandraCQL::Frame> in XS code for better
performance.
-=item *
-
-Support 64bit-challenged perls by using C<Math::BigInt> for 64bit values
-
=back
=cut
@@ -11,9 +11,9 @@ use Test::HexString;
use IO::Handle;
# For 'inet' type
-use Socket qw( AF_INET pack_sockaddr_in unpack_sockaddr_in
- AF_INET6 pack_sockaddr_in6 unpack_sockaddr_in6
- inet_pton inet_ntop );
+use Socket 1.82 qw( AF_INET pack_sockaddr_in unpack_sockaddr_in
+ AF_INET6 pack_sockaddr_in6 unpack_sockaddr_in6
+ inet_pton inet_ntop );
use Protocol::CassandraCQL qw( parse_frame build_frame recv_frame send_frame );
use Protocol::CassandraCQL::Frame;
@@ -18,6 +18,7 @@ use Protocol::CassandraCQL qw(
use Protocol::CassandraCQL::Frame;
my $test_server = IO::Socket::INET->new(
+ LocalHost => "127.0.0.1", # some OSes need this
LocalPort => 0,
Listen => 1,
) or die "Cannot listen - $@";