Data-MessagePack

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.26

    - fixed a serious code typo in PP(makamaka)

0.25

    (NO FEATURE CHANGES)
    - oops. I failed releng.

0.24
    - Fixed a lot of streaming unpacking issues (tokuhirom, gfx)
    - Fixed unpacking issues for 64 bit integers on 32 bit perls (gfx)
    - Improved performance, esp. in unpacking (gfx)

0.23

    (NO FEATURE CHANGES)
    - fixed english docs(hanekomu++)

0.22

README.md  view on Meta::CPAN

- SMALL IN 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.  See [Data::MessagePack::Unpacker](https://metacpan.org/pod/Data%3A%3AMessagePack%3A%3AUnpacker) for
    details.

If you want to get more information about the MessagePack format,
please visit to [http://msgpack.org/](http://msgpack.org/).

# METHODS

- `my $packed = Data::MessagePack->pack($data[, $max_depth]);`

README.md  view on Meta::CPAN


# TODO

- Error handling

    MessagePack cannot deal with complex scalars such as object references,
    filehandles, and code references. We should report the errors more kindly.

- Streaming deserializer

    The current implementation of the streaming deserializer does not have internal
    buffers while some other bindings (such as Ruby binding) does. This limitation
    will astonish those who try to unpack byte streams with an arbitrary buffer size
    (e.g. `while(read($socket, $buffer, $arbitrary_buffer_size)) { ... }`).
    We should implement the internal buffer for the unpacker.

# FAQ

- Why does Data::MessagePack have pure perl implementations?

    msgpack C library uses C99 feature, VC++6 does not support C99. So pure perl version is needed for VC++ users.

include/msgpack/unpack.h  view on Meta::CPAN

    size_t initial_buffer_size;
    void* ctx;
} msgpack_unpacker;


#ifndef MSGPACK_UNPACKER_INIT_BUFFER_SIZE
#define MSGPACK_UNPACKER_INIT_BUFFER_SIZE (64*1024)
#endif

/**
 * Initializes a streaming deserializer.
 * The initialized deserializer must be destroyed by msgpack_unpacker_destroy(msgpack_unpacker*).
 */
MSGPACK_DLLEXPORT
bool msgpack_unpacker_init(msgpack_unpacker* mpac, size_t initial_buffer_size);

/**
 * Destroys a streaming deserializer initialized by msgpack_unpacker_init(msgpack_unpacker*, size_t).
 */
MSGPACK_DLLEXPORT
void msgpack_unpacker_destroy(msgpack_unpacker* mpac);


/**
 * Creates a streaming deserializer.
 * The created deserializer must be destroyed by msgpack_unpacker_free(msgpack_unpacker*).
 */
MSGPACK_DLLEXPORT
msgpack_unpacker* msgpack_unpacker_new(size_t initial_buffer_size);

/**
 * Frees a streaming deserializer created by msgpack_unpacker_new(size_t).
 */
MSGPACK_DLLEXPORT
void msgpack_unpacker_free(msgpack_unpacker* mpac);


#ifndef MSGPACK_UNPACKER_RESERVE_SIZE
#define MSGPACK_UNPACKER_RESERVE_SIZE (32*1024)
#endif

/**

include/msgpack/unpack.h  view on Meta::CPAN


/**
 * Initializes a msgpack_unpacked object.
 * The initialized object must be destroyed by msgpack_unpacked_destroy(msgpack_unpacker*).
 * Use the object with msgpack_unpacker_next(msgpack_unpacker*, msgpack_unpacked*) or
 * msgpack_unpack_next(msgpack_unpacked*, const char*, size_t, size_t*).
 */
static inline void msgpack_unpacked_init(msgpack_unpacked* result);

/**
 * Destroys a streaming deserializer initialized by msgpack_unpacked().
 */
static inline void msgpack_unpacked_destroy(msgpack_unpacked* result);

/**
 * Releases the memory zone from msgpack_unpacked object.
 * The released zone must be freed by msgpack_zone_free(msgpack_zone*).
 */
static inline msgpack_zone* msgpack_unpacked_release_zone(msgpack_unpacked* result);


lib/Data/MessagePack.pm  view on Meta::CPAN

=item SMALL IN 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.

=item STREAMING DESERIALIZER

MessagePack supports streaming deserializer. It is useful for
networking such as RPC.  See L<Data::MessagePack::Unpacker> for
details.

=back

If you want to get more information about the MessagePack format,
please visit to L<http://msgpack.org/>.

=head1 METHODS

lib/Data/MessagePack.pm  view on Meta::CPAN


=over

=item Error handling

MessagePack cannot deal with complex scalars such as object references,
filehandles, and code references. We should report the errors more kindly.

=item Streaming deserializer

The current implementation of the streaming deserializer does not have internal
buffers while some other bindings (such as Ruby binding) does. This limitation
will astonish those who try to unpack byte streams with an arbitrary buffer size
(e.g. C<< while(read($socket, $buffer, $arbitrary_buffer_size)) { ... } >>).
We should implement the internal buffer for the unpacker.

=back

=head1 FAQ

=over 4

lib/Data/MessagePack/Unpacker.pod  view on Meta::CPAN

=head1 NAME

Data::MessagePack::Unpacker - (DEPRECATED)messagepack streaming deserializer

=head1 DESCRIPTION

This module was deprecated. This module have a critical issue.
Use L<Data::MessagePack::Stream> instead.



( run in 0.266 second using v1.01-cache-2.11-cpan-4d50c553e7e )