NAME

DR::Msgpuck - Perl bindings for msgpuck.

SYNOPSIS

use DR::Msgpuck;
my $blob = msgpack { a => 'b', c => 'd' };
my $object = msgunpack $blob;

# all $object's string are utf8
my $object = msgunpack_utf8 $blob;

DESCRIPTION

msgpuck is a simple and efficient msgpack binary serialization library in a self-contained header file.

Boolean

Msgpack protocol provides true/false values. They are unpacks to DR::Msgpuck::True and DR::Msgpuck::False instances.

Injections

If You have an object that can msgpack by itself, provide method TO_MSGPACK in it. Example:

package MyExt;
sub new {
    my ($class, $value) = @_;
    bless \$value => ref($class) || $class;
}

sub TO_MSGPACK {
    my ($self) = @_;
    pack 'CC', 0xA1, substr $$self, 0, 1;
}


package main;
use MyStr;

my $object = {
    a   => 'b',
    c   => 'd',
    e   => MyExt->new('f')
};
my $blob = msgpack($object);
...

BENCHMARKS

    Packing benchmark
			 Rate data-messagepack       dr-msgpuck
    data-messagepack 211416/s               --             -31%
    dr-msgpuck       306279/s              45%               --

    Unpacking benchmark 
			 Rate       dr-msgpuck data-messagepack
    dr-msgpuck       191681/s               --              -7%
    data-messagepack 206313/s               8%               --

AUTHOR

Dmitry E. Oboukhov, <unera@debian.org>

COPYRIGHT AND LICENSE

Copyright (C) 2016 by Dmitry E. Oboukhov

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.