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.88 by root, Thu Sep 7 23:52:24 2023 UTC vs.
Revision 1.89 by root, Fri Sep 8 20:03:06 2023 UTC

64 64
65package CBOR::XS; 65package CBOR::XS;
66 66
67use common::sense; 67use common::sense;
68 68
69our $VERSION = 1.86; 69our $VERSION = 1.87;
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;
245isn't prepared for this will not leak memory. 245isn't prepared for this will not leak memory.
246 246
247If C<$enable> is false (the default), then C<decode> will throw an error 247If C<$enable> is false (the default), then C<decode> will throw an error
248when it encounters a self-referential/cyclic data structure. 248when it encounters a self-referential/cyclic data structure.
249 249
250FUTURE DIRECTION: the motivation behind this option is to avoid I<real> 250This option does not affect C<encode> in any way - shared values and
251cycles - future versions of this module might chose to decode cyclic data 251references will always be encoded properly if present.
252structures using weak references when this option is off, instead of 252
253throwing an error. 253=item $cbor = $cbor->allow_weak_cycles ([$enable])
254
255=item $enabled = $cbor->get_allow_weak_cycles
256
257This works like C<allow_cycles> in that it allows the resulting data
258structures to contain cycles, but unlike C<allow_cycles>, those cyclic
259rreferences will be weak. That means that code that recurrsively walks
260the data structure must be prepared with cycles, but at least not special
261precautions must be implemented to free these data structures.
262
263Only those references leading to actual cycles will be weakened - other
264references, e.g. when the same hash or arrray is referenced multiple times
265in an arrray, will be normal references.
254 266
255This option does not affect C<encode> in any way - shared values and 267This option does not affect C<encode> in any way - shared values and
256references will always be encoded properly if present. 268references will always be encoded properly if present.
257 269
258=item $cbor = $cbor->forbid_objects ([$enable]) 270=item $cbor = $cbor->forbid_objects ([$enable])

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines