… | |
… | |
766 | |
766 | |
767 | =item CBOR::XS::as_map [key => value...] |
767 | =item CBOR::XS::as_map [key => value...] |
768 | |
768 | |
769 | Treat the array reference as key value pairs and output a CBOR map. This |
769 | Treat the array reference as key value pairs and output a CBOR map. This |
770 | allows you to generate CBOR maps with arbitrary key types (or, if you |
770 | allows you to generate CBOR maps with arbitrary key types (or, if you |
771 | don't care about semantics, duplicate keys or prairs in a custom order), |
771 | don't care about semantics, duplicate keys or pairs in a custom order), |
772 | which is otherwise hard to do with Perl. |
772 | which is otherwise hard to do with Perl. |
773 | |
773 | |
774 | The single argument must be an array reference with an even number of |
774 | The single argument must be an array reference with an even number of |
775 | elements. |
775 | elements. |
|
|
776 | |
|
|
777 | Note that only the reference to the array is copied, the array itself is |
|
|
778 | not. Modifications done to the array before calling an encoding fuinction |
|
|
779 | will be reflected in the encoded output. |
776 | |
780 | |
777 | Example: encode a CBOR map with a string and an integer as keys. |
781 | Example: encode a CBOR map with a string and an integer as keys. |
778 | |
782 | |
779 | encode_cbor CBOR::XS::as_map [string => "value", 5 => "value"] |
783 | encode_cbor CBOR::XS::as_map [string => "value", 5 => "value"] |
780 | |
784 | |