--- CBOR-XS/README 2021/10/21 01:14:58 1.22 +++ CBOR-XS/README 2023/09/08 20:03:06 1.23 @@ -167,7 +167,7 @@ support, the resulting data structure might be unusable. Detecting shared values incurs a runtime overhead when values are - encoded that have a reference counter large than one, and might + encoded that have a reference counter larger than one, and might unnecessarily increase the encoded size, as potentially shared values are encoded as shareable whether or not they are actually shared. @@ -195,10 +195,21 @@ If $enable is false (the default), then "decode" will throw an error when it encounters a self-referential/cyclic data structure. - FUTURE DIRECTION: the motivation behind this option is to avoid - *real* cycles - future versions of this module might chose to decode - cyclic data structures using weak references when this option is - off, instead of throwing an error. + This option does not affect "encode" in any way - shared values and + references will always be encoded properly if present. + + $cbor = $cbor->allow_weak_cycles ([$enable]) + $enabled = $cbor->get_allow_weak_cycles + This works like "allow_cycles" in that it allows the resulting data + structures to contain cycles, but unlike "allow_cycles", those + cyclic rreferences will be weak. That means that code that + recurrsively walks the data structure must be prepared with cycles, + but at least not special precautions must be implemented to free + these data structures. + + Only those references leading to actual cycles will be weakened - + other references, e.g. when the same hash or arrray is referenced + multiple times in an arrray, will be normal references. This option does not affect "encode" in any way - shared values and references will always be encoded properly if present. @@ -416,7 +427,7 @@ a full CBOR object is available, but is much more efficient. It basically works by parsing as much of a CBOR string as possible - if - the CBOR data is not complete yet, the pasrer will remember where it + the CBOR data is not complete yet, the parser will remember where it was, to be able to restart when more data has been accumulated. Once enough data is available to either decode a complete CBOR value or raise an error, a real decode will be attempted. @@ -550,8 +561,7 @@ Types::Serialiser::true, Types::Serialiser::false, Types::Serialiser::error These special values become CBOR true, CBOR false and CBOR undefined - values, respectively. You can also use "\1", "\0" and "\undef" - directly if you want. + values, respectively. other blessed objects Other blessed objects are serialised via "TO_CBOR" or "FREEZE". See