Revision history for Perl extension Sereal-Encoder
+0.37 Mon Sep 2 07:40 2013 (AMS time)
+ - Windows and C89 fixes
+ - Band-aid: Skip test failing due to hash-randomization [Zefram]
+
+0.36 Tue May 7 12:00 2013 (AMS time)
+ [changelog for encoder and decoder both]
+ - Add "incremental" option to decoder for easier decoding of
+ multiple sereal documents in one buffer.
+ - Make snappy and snappy_incr options mutually exclusive.
+ - Feature: Implement aliasing for deduping (aliased_dedupe_strings)
+
0.35 Mon Apr 1 11:50 2013 (AMS time)
- Add new no_bless_objects option from Simon Bertrang.
t/lib/Sereal/BulkTest.pm
t/lib/Sereal/TestSet.pm
typemap
-META.yml Module meta-data (added by MakeMaker)
+META.yml Module YAML meta-data (added by MakeMaker)
+META.json Module JSON meta-data (added by MakeMaker)
--- /dev/null
+{
+ "abstract" : "Fast, compact, powerful binary serialization",
+ "author" : [
+ "Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>"
+ ],
+ "dynamic_config" : 1,
+ "generated_by" : "ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921",
+ "license" : [
+ "perl_5"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Sereal-Encoder",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "inc"
+ ]
+ },
+ "prereqs" : {
+ "build" : {
+ "requires" : {
+ "Data::Dumper" : "0",
+ "ExtUtils::ParseXS" : "2.21",
+ "File::Find" : "0",
+ "File::Path" : "0",
+ "File::Spec" : "0",
+ "Scalar::Util" : "0",
+ "Test::LongString" : "0",
+ "Test::More" : "0.88",
+ "Test::Warn" : "0"
+ }
+ },
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "0"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "XSLoader" : "0",
+ "perl" : "5.008"
+ }
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "bugtracker" : {
+ "web" : "https://github.com/Sereal/Sereal/issues"
+ },
+ "repository" : {
+ "url" : "git://github.com/Sereal/Sereal.git"
+ }
+ },
+ "version" : "0.37"
+}
---- #YAML:1.0
-name: Sereal-Encoder
-version: 0.36
-abstract: Fast, compact, powerful binary serialization
+---
+abstract: 'Fast, compact, powerful binary serialization'
author:
- - Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>
-license: perl
-distribution_type: module
-configure_requires:
- ExtUtils::MakeMaker: 0
+ - 'Steffen Mueller <smueller@cpan.org>, Yves Orton <yves@cpan.org>'
build_requires:
- Data::Dumper: 0
- ExtUtils::ParseXS: 2.21
- File::Find: 0
- File::Path: 0
- File::Spec: 0
- Scalar::Util: 0
- Test::LongString: 0
- Test::More: 0.88
- Test::Warn: 0
+ Data::Dumper: 0
+ ExtUtils::ParseXS: 2.21
+ File::Find: 0
+ File::Path: 0
+ File::Spec: 0
+ Scalar::Util: 0
+ Test::LongString: 0
+ Test::More: 0.88
+ Test::Warn: 0
+configure_requires:
+ ExtUtils::MakeMaker: 0
+dynamic_config: 1
+generated_by: 'ExtUtils::MakeMaker version 6.64, CPAN::Meta::Converter version 2.120921'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: Sereal-Encoder
+no_index:
+ directory:
+ - t
+ - inc
requires:
- perl: 5.008
- XSLoader: 0
+ XSLoader: 0
+ perl: 5.008
resources:
- bugtracker: https://github.com/Sereal/Sereal/issues
- repository: git://github.com/Sereal/Sereal.git
-no_index:
- directory:
- - t
- - inc
-generated_by: ExtUtils::MakeMaker version 6.56
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ bugtracker: https://github.com/Sereal/Sereal/issues
+ repository: git://github.com/Sereal/Sereal.git
+version: 0.37
my $flags = $2;
my $len = varint();
my $hdr = substr($data, 0, $len, '');
+
+ my $proto_version = ord($flags) & SRL_PROTOCOL_VERSION_MASK;
+ print "Sereal protocol version: $proto_version\n";
if (length($hdr)) {
print "Header($len): " . join(" ", map ord, split //, $hdr) . "\n";
}
my $encoding= ord($flags) & SRL_PROTOCOL_ENCODING_MASK;
if ($encoding == SRL_PROTOCOL_ENCODING_SNAPPY) {
+ print "Header says: Document body is Snappy-compressed.\n";
require Compress::Snappy;
my $out = Compress::Snappy::decompress($data);
$data = $out;
- } elsif ($encoding) {
- die "Invalid encoding";
+ } elsif ($encoding == SRL_PROTOCOL_ENCODING_SNAPPY_INCREMENTAL) {
+ die "Incremental Snappy encoding not implemented in hobodecoder. (yet. It's easy to do.)";
+ }
+ elsif ($encoding) {
+ die "Invalid encoding '" . ($encoding >> SRL_PROTOCOL_VERSION_BITS) . "'";
}
}
/* When generated this function returned values for the list of names given
here. However, subsequent manual editing may have added or removed some.
SRL_HDR_ARRAYREF SRL_HDR_NEG_HIGH SRL_HDR_POS_HIGH SRL_HDR_RESERVED
- SRL_HDR_STR_UTF8 SRL_NEG_MIN_SIZE SRL_POS_MAX_SIZE */
+ SRL_HDR_STR_UTF8 SRL_MAGIC_STRLEN SRL_NEG_MIN_SIZE SRL_POS_MAX_SIZE */
/* Offset 8 gives the best switch position. */
switch (name[8]) {
case 'A':
return PERL_constant_ISIV;
#else
return PERL_constant_NOTDEF;
+#endif
+ }
+ break;
+ case 'C':
+ if (memEQ(name, "SRL_MAGIC_STRLEN", 16)) {
+ /* ^ */
+#ifdef SRL_MAGIC_STRLEN
+ *iv_return = SRL_MAGIC_STRLEN;
+ return PERL_constant_ISIV;
+#else
+ return PERL_constant_NOTDEF;
#endif
}
break;
SRL_HDR_SHORT_BINARY SRL_HDR_SHORT_BINARY_HIGH
SRL_HDR_SHORT_BINARY_LOW SRL_HDR_STR_UTF8 SRL_HDR_TRACK_FLAG
SRL_HDR_TRUE SRL_HDR_UNDEF SRL_HDR_VARINT SRL_HDR_WEAKEN
- SRL_HDR_ZIGZAG SRL_MAGIC_STRING_LILIPUTIAN
+ SRL_HDR_ZIGZAG SRL_MAGIC_STRING_LILIPUTIAN SRL_MAGIC_STRLEN
SRL_MASK_ARRAYREF_COUNT SRL_MASK_HASHREF_COUNT
SRL_MASK_SHORT_BINARY_LEN SRL_NEG_MIN_SIZE SRL_POS_MAX_SIZE
SRL_PROTOCOL_ENCODING_MASK SRL_PROTOCOL_ENCODING_RAW
use Carp qw/croak/;
use XSLoader;
-our $VERSION = '0.36'; # Don't forget to update the TestCompat set for testing against installed decoders!
+our $VERSION = '0.37'; # Don't forget to update the TestCompat set for testing against installed decoders!
# not for public consumption, just for testing.
my $TestCompat = [ map sprintf("%.2f", $_/100), reverse( 23 .. int($VERSION * 100) ) ]; # compat with 0.23 to ...
=head1 DESCRIPTION
-B<This is an experimental module. The interface may change without notice.
-Before using it in production, please get in touch with the authors!>
-
This library implements an efficient, compact-output, and feature-rich
serializer using a binary protocol called I<Sereal>.
Its sister module L<Sereal::Decoder> implements a decoder for this format.
require Exporter;
our @EXPORT_OK;
BEGIN { @EXPORT_OK = qw(
+ SRL_MAGIC_STRLEN
SRL_MAGIC_STRING_LILIPUTIAN
SRL_PROTOCOL_VERSION
SRL_PROTOCOL_VERSION_BITS
#define MY_CAN_FIND_PLACEHOLDERS
#define HAS_SV2OBJ
#endif
-#if (PERL_VERSION >= 10)
+
+/* hv_backreferences_p is not marked as exported in embed.fnc in any perl */
+#if (PERL_VERSION >= 10 && !defined(WIN32) && !defined(_WIN32))
#define HAS_HV_BACKREFS
#endif
# define RX_PRECOMP(re) ((re)->precomp)
# define RX_PRELEN(re) ((re)->prelen)
-// Maybe this is only on OS X, where SvUTF8(sv) exists but looks at flags that don't exist
+/* Maybe this is only on OS X, where SvUTF8(sv) exists but looks at flags that don't exist */
# define RX_UTF8(re) (RX_EXTFLAGS(re) & RXf_UTF8)
#elif defined(SvRX)
AV *backrefs;
SV* refsv= NULL;
UV weakref_ofs= 0; /* preserved between loops */
+ int nobless;
SSize_t ref_rewrite_pos= 0; /* preserved between loops - note SSize_t is a perl define */
assert(src);
- int nobless = SRL_ENC_HAVE_OPTION(enc, SRL_F_NO_BLESS_OBJECTS);
+ nobless = SRL_ENC_HAVE_OPTION(enc, SRL_F_NO_BLESS_OBJECTS);
if (++enc->recursion_depth == enc->max_recursion_depth) {
croak("Hit maximum recursion depth (%lu), aborting serialization",
/* magic string, protocol version and encoding information */
#define SRL_MAGIC_STRING "=srl" /* Magic string for header. Every packet starts with this */
+#define SRL_MAGIC_STRLEN 4 /* Length of SRL_MAGIC_STRING */
#define SRL_MAGIC_STRING_LILIPUTIAN 0x6c72733d /* SRL_MAGIC_STRING as a little endian integer */
#define SRL_PROTOCOL_VERSION ( 1 ) /* this is the first. for some reason we did not use 0 */
foreach my $x ( 0 .. $#keys ) {
foreach my $y ($x + 1 .. $#keys) {
is($encoded{$keys[$x]}, $encoded{$keys[$y]},"$keys[$x] vs $keys[$y] (same: sort_keys)");
- isnt($encoded_unsorted{$keys[$x]}, $encoded_unsorted{$keys[$y]},"$keys[$x] vs $keys[$y] (different: no sort_keys)");
+ SKIP: {
+ skip "test causes random false failures", 1;
+ isnt($encoded_unsorted{$keys[$x]}, $encoded_unsorted{$keys[$y]},"$keys[$x] vs $keys[$y] (different: no sort_keys)");
+ }
}
}