DR::Tarantool::MsgPack - msgpack encoder/decoder.
use DR::Tarantool::MsgPack 'msgpack', 'msgunpack', 'msgcheck'; # encode object my $pkt = msgpack({ a => 'b' }); # decode object my $object = msgunpack($pkt); # decode object with utf8-strings my $object = msgunpack($pkt, 1); # check if $string is valid msgpack $object = msgunpack($str, 1) if msgcheck($str);
Encode perl object (scalar, hash, array) to octets.
Decide octets to perl object. Return perl object and tail of input string.
If $UTF8 is true, msgunpack will decode utf8-strings.
$UTF8
Protocol supports true and false statements. msgunpack unpacks them to 1 and 0.
true
false
1
0
If You want to pack true You can use DR::Tarantool::MsgPack::Bool:
use DR::Tarantool::MsgPack 'msgpack'; my $to_pack = { a => DR::Tarantool::MsgPack::Bool->new(0) }; my $pkt = msgpack($to_pack);
To install DR::Tarantool, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DR::Tarantool
CPAN shell
perl -MCPAN -e shell install DR::Tarantool
For more information on module installation, please visit the detailed CPAN module installation guide.