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.51 by root, Sun Apr 24 19:16:15 2016 UTC vs.
Revision 1.52 by root, Mon Apr 25 18:17:17 2016 UTC

246If C<$enable> is false (the default), then C<encode> will encode strings 246If C<$enable> is false (the default), then C<encode> will encode strings
247the standard CBOR way. 247the standard CBOR way.
248 248
249This option does not affect C<decode> in any way - string references will 249This option does not affect C<decode> in any way - string references will
250always be decoded properly if present. 250always be decoded properly if present.
251
252=item $cbor = $cbor->text_keys ([$enable])
253
254=item $enabled = $cbor->get_text_keys
255
256If C<$enabled> is true (or missing), then C<encode> will encode all
257perl hash keys as CBOR text strings/UTF-8 string, upgrading them as needed.
258
259If C<$enable> is false (the default), then C<encode> will encode hash keys
260normally - upgraded perl strings (strings internally encoded as UTF-8) as
261CBOR text strings, and downgraded perl strings as CBOR byte strings.
262
263This option does not affect C<decode> in any way.
264
265This option is useful for interoperability with CBOR decoders that don't
266treat byte strings as a form of text. It is especially useful as Perl
267gives very little control over hash keys.
268
269Enabling this option can be slow, as all downgraded hash keys that are
270encoded need to be scanned and converted to UTF-8.
271
272=item $cbor = $cbor->text_strings ([$enable])
273
274=item $enabled = $cbor->get_text_strings
275
276This option works similar to C<text_keys>, above, but works on all strings
277(including hash keys), so C<text_keys> has no further effect after
278enabling C<text_strings>.
279
280If C<$enabled> is true (or missing), then C<encode> will encode all perl
281strings as CBOR text strings/UTF-8 strings, upgrading them as needed.
282
283If C<$enable> is false (the default), then C<encode> will encode strings
284normally (but see C<text_keys>) - upgraded perl strings (strings
285internally encoded as UTF-8) as CBOR text strings, and downgraded perl
286strings as CBOR byte strings.
287
288This option does not affect C<decode> in any way.
289
290This option has similar advantages and disadvantages as C<text_keys>. In
291addition, this option effectively removes the ability to encode byte
292strings, which might break some C<FREEZE> and C<TO_CBOR> methods that rely
293on this, such as bignum encoding, so this option is mainly useful for very
294simple data.
251 295
252=item $cbor = $cbor->validate_utf8 ([$enable]) 296=item $cbor = $cbor->validate_utf8 ([$enable])
253 297
254=item $enabled = $cbor->get_validate_utf8 298=item $enabled = $cbor->get_validate_utf8
255 299
663 "$self" # encode url string 707 "$self" # encode url string
664 } 708 }
665 709
666 sub URI::THAW { 710 sub URI::THAW {
667 my ($class, $serialiser, $uri) = @_; 711 my ($class, $serialiser, $uri) = @_;
668
669 $class->new ($uri) 712 $class->new ($uri)
670 } 713 }
671 714
672Unlike C<TO_CBOR>, multiple values can be returned by C<FREEZE>. For 715Unlike C<TO_CBOR>, multiple values can be returned by C<FREEZE>. For
673example, a C<FREEZE> method that returns "type", "id" and "variant" values 716example, a C<FREEZE> method that returns "type", "id" and "variant" values

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines