NAME Data::MessagePack - MessagePack serialising/deserialising SYNOPSIS my $packed = Data::MessagePack->pack($dat); my $unpacked = Data::MessagePack->unpack($dat); DESCRIPTION This module converts Perl data structures to MessagePack and vice versa. ABOUT MESSAGEPACK FORMAT MessagePack is a binary-based efficient object serialization format. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small. ADVANTAGES PORTABILITY Messagepack is language independent binary serialize format. SMALL SIZE say length(JSON::XS::encode_json({a=>1, b=>2})); # => 13 say length(Storable::nfreeze({a=>1, b=>2})); # => 21 say length(Data::MessagePack->pack({a=>1, b=>2})); # => 7 The MessagePack format saves memory than JSON and Storable format. STREAMING DESERIALIZER MessagePack supports streaming deserializer. It is useful for networking such as RPC. If you want to get more information about the MessagePack format, please visit to . METHODS my $packed = Data::MessagePack->pack($data[, $max_depth]); Pack the $data to messagepack format string. This method throws an exception when the perl structure is nested more than $max_depth levels(default: 512) in order to detect circular references. Data::MessagePack->pack() throws an exception when encountering blessed object, because MessagePack is language-independent format. my $unpacked = Data::MessagePack->unpack($msgpackstr); unpack the $msgpackstr to a MessagePack format string. Configuration Variables $Data::MessagePack::PreferInteger Pack the string as int when the value looks like int(EXPERIMENTAL). SPEED This is the result of benchmark/serialize.pl and benchmark/deserialize.pl on my SC440(Linux 2.6.32-23-server #37-Ubuntu SMP). -- serialize JSON::XS: 2.3 Data::MessagePack: 0.20 Storable: 2.21 Benchmark: timing 1000000 iterations of json, mp, storable... json: 5 wallclock secs ( 3.95 usr + 0.00 sys = 3.95 CPU) @ 253164.56/s (n=1000000) mp: 3 wallclock secs ( 2.69 usr + 0.00 sys = 2.69 CPU) @ 371747.21/s (n=1000000) storable: 26 wallclock secs (27.21 usr + 0.00 sys = 27.21 CPU) @ 36751.19/s (n=1000000) -- deserialize JSON::XS: 2.3 Data::MessagePack: 0.20 Storable: 2.21 Benchmark: timing 1000000 iterations of json, mp, storable... json: 4 wallclock secs ( 4.45 usr + 0.00 sys = 4.45 CPU) @ 224719.10/s (n=1000000) mp: 6 wallclock secs ( 5.45 usr + 0.00 sys = 5.45 CPU) @ 183486.24/s (n=1000000) storable: 7 wallclock secs ( 7.77 usr + 0.00 sys = 7.77 CPU) @ 128700.13/s (n=1000000) AUTHORS Tokuhiro Matsuno Makamaka Hannyaharamitu THANKS TO Jun Kuriyama Dan Kogai FURUHASHI Sadayuki hanekomu LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO is official web site for MessagePack format.