DR::Tnt::Msgpack - msgpack encoder/decoder.
use DR::Tnt::Msgpack; use DR::Tnt::Msgpack::Types ':all'; # mp_* my $blob = msgpack { a => 'b', c => 123, d => [ 3, 4, 5 ] }; my $object = msgunpack $blob; my $object = msgunpack_utf8 $blob; my ($object, $len) = msgunpack_safely $blob; my ($object, $len) = msgunpack_safely_utf8 $blob; if (defined $len) { substr $blob, 0, $len, ''; ... } if (my $len = msgunpack_check $blob) { # $blob contains msgpack with len=$len }
my $blob = msgpack $scalar; my $blob = msgpack \%hash; my $blob = msgpack \@array;
Pack any perl object to msgpack. Blessed objects have to have TO_MSGPACK methods.
TO_MSGPACK
Unpack msgpack'ed string to perl object. Throws exception if buffer is invalid. Booleans are extracted to DR::Tnt::Msgpack::Types::Bool, see also DR::Tnt::Msgpack::Types.
The same as "msgunpack". Decode utf8 for each string.
Unpack msgpack'ed string to perl object. Don't throw exception if buffer is invalid.
Return unpacked object and length of unpacked object. If length is undef, buffer is invalid.
undef
To install DR::Tnt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DR::Tnt
CPAN shell
perl -MCPAN -e shell install DR::Tnt
For more information on module installation, please visit the detailed CPAN module installation guide.