NAME

DR::Tnt::Msgpack::Types - types for msgpack.

SYNOPSIS

    use DR::Tnt::Msgpack::Types;

    # pack as msgpack INT
    msgpack(mp_int(123));

    # pack number as string
    msgpack(mp_string(123));

    # bools
    msgpack(mp_true);
    msgpack(mp_false);
    msgpack(mp_bool(1));
    msgpack(mp_bool(0));


    # blob
    msgpack(mp_blob $blob);

DESCRIPTION

Perl doesn't differ 123 and '123':

    msgpack(123);
    msgpack('123'); # the same

From time to time You want to pack numbers as strings (for example You use tarantool's STR-index for user's texts, that contain numbers, too).

So You can use mp_string($) constructor for DR::Tnt::Msgpack::Types::Str.

METHODS

mp_int($)

Create DR::Tnt::Msgpack::Types::Int object. Its method TO_MSGPACK packs number as msgpack signed integer value.

mp_string($)

Create DR::Tnt::Msgpack::Types::Str object. Its method TO_MSGPACK packs perl scalar as msgpack string.

mp_blob($)

Create DR::Tnt::Msgpack::Types::Blob object. Its method TO_MSGPACK packs perl scalar as msgpack bin object.

mp_bool($) and shortcuts mp_true/mp_false

Create DR::Tnt::Msgpack::Types::Bool object. Its method TO_MSGPACK package perl scalar as msgpack boolean.