--- CBOR-XS/XS.pm 2013/10/29 15:13:50 1.12 +++ CBOR-XS/XS.pm 2013/10/29 15:56:31 1.13 @@ -60,7 +60,7 @@ use common::sense; -our $VERSION = 0.05; +our $VERSION = 0.06; our @ISA = qw(Exporter); our @EXPORT = qw(encode_cbor decode_cbor); @@ -285,8 +285,9 @@ =item CBOR::XS::Tagged objects Objects of this type must be arrays consisting of a single C<[tag, value]> -pair. The (numerical) tag will be encoded as a CBOR tag, the value will be -encoded as appropriate for the value. +pair. The (numerical) tag will be encoded as a CBOR tag, the value will +be encoded as appropriate for the value. You cna use C to +create such objects. =item Types::Serialiser::true, Types::Serialiser::false, Types::Serialiser::error @@ -518,6 +519,33 @@ $_[0][1] } +=head2 EXAMPLES + +Here are some examples of C uses to tag objects. + +You can look up CBOR tag value and emanings in the IANA registry at +L. + +Prepend a magic header (C<$CBOR::XS::MAGIC>): + + my $cbor = encode_cbor CBOR::XS::tag 55799, $value; + # same as: + my $cbor = $CBOR::XS::MAGIC . encode_cbor $value; + +Serialise some URIs and a regex in an array: + + my $cbor = encode_cbor [ + (CBOR::XS::tag 32, "http://www.nethype.de/"), + (CBOR::XS::tag 32, "http://software.schmorp.de/"), + (CBOR::XS::tag 35, "^[Pp][Ee][Rr][lL]\$"), + ]; + +Wrap CBOR data in CBOR: + + my $cbor_cbor = encode_cbor + CBOR::XS::tag 24, + encode_cbor [1, 2, 3]; + =head1 CBOR and JSON CBOR is supposed to implement a superset of the JSON data model, and is,