Raku Land

CBOR::Simple

Actions Status

NAME

CBOR::Simple - Simple codec for the CBOR serialization format

SYNOPSIS

use CBOR::Simple; # Encode a Raku value to CBOR, or vice-versa my $cbor = cbor-encode($value); my $val1 = cbor-decode($cbor); # Fails if more data past first decoded value my $val2 = cbor-decode($cbor, my $pos = 0); # Updates $pos after decoding first value # By default, cbor-decode() marks partially corrupt parsed structures with # Failure nodes at the point of corruption my $bad = cbor-decode(buf8.new(0x81 xx 3)); # [[[Failure]]] # Callers can instead force throwing exceptions on any error my $*CBOR_SIMPLE_FATAL_ERRORS = True; my $bad = cbor-decode(buf8.new(0x81 xx 3)); # BOOM! # Decode CBOR into diagnostic text, used for checking encodings and complex structures my $diag = cbor-diagnostic($cbor);

DESCRIPTION

CBOR::Simple is a trivial implementation of the core functionality of the CBOR serialization format, implementing the standard as of RFC 8949.

NYI

Currently known NOT to work:

DATETIME AND INSTANT

Raku's builtin time handling is richer than the default CBOR data model, so the following mappings apply:

OTHER SPECIAL CASES

AUTHOR

Geoffrey Broadwell gjb@sonic.net

COPYRIGHT AND LICENSE

Copyright 2021 Geoffrey Broadwell

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.