ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/XS.pm
(Generate patch)

Comparing CBOR-XS/XS.pm (file contents):
Revision 1.82 by root, Sat May 8 07:08:12 2021 UTC vs.
Revision 1.88 by root, Thu Sep 7 23:52:24 2023 UTC

64 64
65package CBOR::XS; 65package CBOR::XS;
66 66
67use common::sense; 67use common::sense;
68 68
69our $VERSION = 1.83; 69our $VERSION = 1.86;
70our @ISA = qw(Exporter); 70our @ISA = qw(Exporter);
71 71
72our @EXPORT = qw(encode_cbor decode_cbor); 72our @EXPORT = qw(encode_cbor decode_cbor);
73 73
74use Exporter; 74use Exporter;
216communication partner supports the value sharing extensions to CBOR 216communication partner supports the value sharing extensions to CBOR
217(L<http://cbor.schmorp.de/value-sharing>), as without decoder support, the 217(L<http://cbor.schmorp.de/value-sharing>), as without decoder support, the
218resulting data structure might be unusable. 218resulting data structure might be unusable.
219 219
220Detecting shared values incurs a runtime overhead when values are encoded 220Detecting shared values incurs a runtime overhead when values are encoded
221that have a reference counter large than one, and might unnecessarily 221that have a reference counter larger than one, and might unnecessarily
222increase the encoded size, as potentially shared values are encoded as 222increase the encoded size, as potentially shared values are encoded as
223shareable whether or not they are actually shared. 223shareable whether or not they are actually shared.
224 224
225At the moment, only targets of references can be shared (e.g. scalars, 225At the moment, only targets of references can be shared (e.g. scalars,
226arrays or hashes pointed to by a reference). Weirder constructs, such as 226arrays or hashes pointed to by a reference). Weirder constructs, such as
473Perl data structure in memory at one time, it does allow you to parse a 473Perl data structure in memory at one time, it does allow you to parse a
474CBOR stream incrementally, using a similar to using "decode_prefix" to see 474CBOR stream incrementally, using a similar to using "decode_prefix" to see
475if a full CBOR object is available, but is much more efficient. 475if a full CBOR object is available, but is much more efficient.
476 476
477It basically works by parsing as much of a CBOR string as possible - if 477It basically works by parsing as much of a CBOR string as possible - if
478the CBOR data is not complete yet, the pasrer will remember where it was, 478the CBOR data is not complete yet, the parser will remember where it was,
479to be able to restart when more data has been accumulated. Once enough 479to be able to restart when more data has been accumulated. Once enough
480data is available to either decode a complete CBOR value or raise an 480data is available to either decode a complete CBOR value or raise an
481error, a real decode will be attempted. 481error, a real decode will be attempted.
482 482
483A typical use case would be a network protocol that consists of sending 483A typical use case would be a network protocol that consists of sending
635create such objects. 635create such objects.
636 636
637=item Types::Serialiser::true, Types::Serialiser::false, Types::Serialiser::error 637=item Types::Serialiser::true, Types::Serialiser::false, Types::Serialiser::error
638 638
639These special values become CBOR true, CBOR false and CBOR undefined 639These special values become CBOR true, CBOR false and CBOR undefined
640values, respectively. You can also use C<\1>, C<\0> and C<\undef> directly 640values, respectively.
641if you want.
642 641
643=item other blessed objects 642=item other blessed objects
644 643
645Other blessed objects are serialised via C<TO_CBOR> or C<FREEZE>. See 644Other blessed objects are serialised via C<TO_CBOR> or C<FREEZE>. See
646L<TAG HANDLING AND EXTENSIONS> for specific classes handled by this 645L<TAG HANDLING AND EXTENSIONS> for specific classes handled by this

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines