--- CBOR-XS/XS.pm 2013/11/22 16:18:59 1.24 +++ CBOR-XS/XS.pm 2013/11/28 12:11:06 1.26 @@ -58,7 +58,7 @@ In addition to the core CBOR data format, this module implements a number of extensions, to support cyclic and self-referencing data structures -(see C), string deduplication (see C) and +(see C), string deduplication (see C) and scalar references (always enabled). The primary goal of this module is to be I and the secondary goal @@ -188,11 +188,13 @@ This means that such values will only be encoded once, and will not result in a deep cloning of the value on decode, in decoders supporting the value -sharing extension. +sharing extension. This also makes it possible to encode cyclic data +structures. It is recommended to leave it off unless you know your communication partner supports the value sharing extensions to CBOR -(http://cbor.schmorp.de/value-sharing). +(L), as without decoder 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 unnecessarily @@ -203,30 +205,32 @@ arrays or hashes pointed to by a reference). Weirder constructs, such as an array with multiple "copies" of the I string, which are hard but not impossible to create in Perl, are not supported (this is the same as -for L). +with L). -If C<$enable> is false (the default), then C will encode -exception when it encounters anything it cannot encode as CBOR. +If C<$enable> is false (the default), then C will encode shared +data structures repeatedly, unsharing them in the process. Cyclic data +structures cannot be encoded in this mode. This option does not affect C in any way - shared values and references will always be decoded properly if present. -=item $cbor = $cbor->allow_stringref ([$enable]) +=item $cbor = $cbor->pack_strings ([$enable]) -=item $enabled = $cbor->get_allow_stringref +=item $enabled = $cbor->get_pack_strings If C<$enable> is true (or missing), then C will try not to encode the same string twice, but will instead encode a reference to the string -instead. Depending on your data format. this can save a lot of space, but +instead. Depending on your data format, this can save a lot of space, but also results in a very large runtime overhead (expect encoding times to be 2-4 times as high as without). It is recommended to leave it off unless you know your communications partner supports the stringref extension to CBOR -(http://cbor.schmorp.de/stringref). +(L), as without decoder support, the +resulting data structure might not be usable. -If C<$enable> is false (the default), then C will encode -exception when it encounters anything it cannot encode as CBOR. +If C<$enable> is false (the default), then C will encode strings +the standard CBOR way. This option does not affect C in any way - string references will always be decoded properly if present. @@ -677,22 +681,22 @@ =over 4 -=item (perl-object, L) +=item 26 (perl-object, L) These tags are automatically created (and decoded) for serialisable objects using the C methods (the L object serialisation protocol). See L for details. -=item , (sharable, sharedref, L ) +=item 28, 29 (sharable, sharedref, L ) These tags are automatically decoded when encountered, resulting in shared values in the decoded object. They are only encoded, however, when C is enabled. -=item , (stringref-namespace, stringref, L ) +=item 256, 25 (stringref-namespace, stringref, L ) These tags are automatically decoded when encountered. They are only -encoded, however, when C is enabled. +encoded, however, when C is enabled. =item 22098 (indirection, L)