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.80 by root, Fri Dec 11 06:05:33 2020 UTC vs.
Revision 1.81 by root, Fri Dec 11 06:10:26 2020 UTC

704=back 704=back
705 705
706=head2 TYPE CASTS 706=head2 TYPE CASTS
707 707
708B<EXPERIMENTAL>: As an experimental extension, C<CBOR::XS> allows you to 708B<EXPERIMENTAL>: As an experimental extension, C<CBOR::XS> allows you to
709force specific cbor types to be used when encoding. That allows you to 709force specific CBOR types to be used when encoding. That allows you to
710encode types not normally accessible (e.g. half floats) as well as force 710encode types not normally accessible (e.g. half floats) as well as force
711string types even when C<text_strings> is in effect. 711string types even when C<text_strings> is in effect.
712 712
713Type forcing is done by calling a special "cast" function which keeps a 713Type forcing is done by calling a special "cast" function which keeps a
714copy of the value and returns a new value that can be handed over to any 714copy of the value and returns a new value that can be handed over to any
756 756
757Forces double-float (IEEE 754 binary64) encoding of the given value. 757Forces double-float (IEEE 754 binary64) encoding of the given value.
758 758
759=item CBOR::XS::as_cbor $cbor_text 759=item CBOR::XS::as_cbor $cbor_text
760 760
761Not a type cast per-se, this type cast forces the argument to eb encoded 761Not a type cast per-se, this type cast forces the argument to be encoded
762as-is. This can be used to embed pre-encoded CBOR data. 762as-is. This can be used to embed pre-encoded CBOR data.
763 763
764Note that no checking on the validity of the C<$cbor_text> is done - it's 764Note that no checking on the validity of the C<$cbor_text> is done - it's
765the callers responsibility to correctly encode values. 765the callers responsibility to correctly encode values.
766 766
773 773
774The single argument must be an array reference with an even number of 774The single argument must be an array reference with an even number of
775elements. 775elements.
776 776
777Note that only the reference to the array is copied, the array itself is 777Note that only the reference to the array is copied, the array itself is
778not. Modifications done to the array before calling an encoding fuinction 778not. Modifications done to the array before calling an encoding function
779will be reflected in the encoded output. 779will be reflected in the encoded output.
780 780
781Example: encode a CBOR map with a string and an integer as keys. 781Example: encode a CBOR map with a string and an integer as keys.
782 782
783 encode_cbor CBOR::XS::as_map [string => "value", 5 => "value"] 783 encode_cbor CBOR::XS::as_map [string => "value", 5 => "value"]

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines