NAME

CBOR::PP::Decode

SYNOPSIS

my $perlvar = CBOR::PP::Decode::decode($binary);

DESCRIPTION

This implements a basic CBOR decoder in pure Perl.

MAPPING CBOR TO PERL

  • All tags are ignored. (This could be iterated on later.)

  • Indefinite-length objects are supported, but streamed parsing is not; the data structure must be complete to be decoded.

  • CBOR text strings are decoded to UTF8-flagged strings, while binary strings are decoded to non-UTF8-flagged strings. In practical terms, this means that a decoded CBOR binary string will have no code point above 255, while a decoded CBOR text string can contain any valid Unicode code point.

  • null, undefined, true, and false become undef, undef, Types::Serialiser::true(), and Types::Serialiser::false(), respectively. (NB: undefined is deserialized as an error object in CBOR::XS, which doesn’t seem to make sense.)

TODO

  • Add tag decode support via callbacks.

  • Make it faster by removing some of the internal buffer copying.

AUTHOR

Gasper Software Consulting (FELIPE)

LICENSE

This code is licensed under the same license as Perl itself.

METHODS

$value = decode( $CBOR_BYTESTRING )

Returns a Perl value that represents the serialized CBOR string.