… | |
… | |
178 | code that isn't prepared for this will not leak memory. |
178 | code that isn't prepared for this will not leak memory. |
179 | |
179 | |
180 | If $enable is false (the default), then "decode" will throw an error |
180 | If $enable is false (the default), then "decode" will throw an error |
181 | when it encounters a self-referential/cyclic data structure. |
181 | when it encounters a self-referential/cyclic data structure. |
182 | |
182 | |
|
|
183 | FUTURE DIRECTION: the motivation behind this option is to avoid |
|
|
184 | *real* cycles - future versions of this module might chose to decode |
|
|
185 | cyclic data structures using weak references when this option is |
|
|
186 | off, instead of throwing an error. |
|
|
187 | |
183 | This option does not affect "encode" in any way - shared values and |
188 | This option does not affect "encode" in any way - shared values and |
184 | references will always be decoded properly if present. |
189 | references will always be encoded properly if present. |
185 | |
190 | |
186 | $cbor = $cbor->pack_strings ([$enable]) |
191 | $cbor = $cbor->pack_strings ([$enable]) |
187 | $enabled = $cbor->get_pack_strings |
192 | $enabled = $cbor->get_pack_strings |
188 | If $enable is true (or missing), then "encode" will try not to |
193 | If $enable is true (or missing), then "encode" will try not to |
189 | encode the same string twice, but will instead encode a reference to |
194 | encode the same string twice, but will instead encode a reference to |