NAME

MsgPack::Encoder - Encode a structure into a MessagePack binary string

VERSION

version 0.0.1

SYNOPSIS

use MsgPack::Encoder;

my $binary = MsgPack::Encoder->new( struct => [ "hello world" ] )->encoded;

use MsgPack::Decoder;

my $struct = MsgPack::Decoder->new->read_all($binary);

DESCRIPTION

MsgPack::Encoder objects encapsulate a Perl data structure, and provide its MessagePack serialization.

CURRENTLY SUPPORTED MESSAGEPACK TYPES

I'm implementing the different messagepack types as I go along. So far, the current types are supported:

Boolean
PositiveFixInt
NegativeFixInt
FixStr
Str8
FixArray
Nil
FixMap
FixExt1

OVERLOADING

Stringification

The stringification of a MsgPack::Encoder object is its MessagePack encoding.

print MsgPack::Encoder->new( struct => $foo );

# equivalent to

print MsgPack::Encoder->new( struct => $foo )->encoded;

METHODS

new( struct => $perl_struct )

The constructor accepts a single argument, struct, which is the perl structure (or simple scalar) to encode.

encoded

Returns the MessagePack representation of the structure.

AUTHOR

Yanick Champoux <yanick@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Yanick Champoux.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.