… | |
… | |
716 | |
716 | |
717 | The following casts are currently available (all of which are unary operators): |
717 | The following casts are currently available (all of which are unary operators): |
718 | |
718 | |
719 | =over |
719 | =over |
720 | |
720 | |
|
|
721 | =item CBOR::XS::as_int $value |
|
|
722 | |
|
|
723 | Forces the value to be encoded as some form of (basic, not bignum) integer |
|
|
724 | type. |
|
|
725 | |
721 | =item CBOR::XS::as_text $value |
726 | =item CBOR::XS::as_text $value |
722 | |
727 | |
723 | Forces the value to be encoded as (UTF-8) text values. |
728 | Forces the value to be encoded as (UTF-8) text values. |
724 | |
729 | |
725 | =item CBOR::XS::as_bytes $value |
730 | =item CBOR::XS::as_bytes $value |
… | |
… | |
753 | |
758 | |
754 | CBOR::XS->new->text_strings->encode ([4, "text", CBOR::XS::bytes "bytevalue"]); |
759 | CBOR::XS->new->text_strings->encode ([4, "text", CBOR::XS::bytes "bytevalue"]); |
755 | |
760 | |
756 | =cut |
761 | =cut |
757 | |
762 | |
|
|
763 | sub CBOR::XS::as_int ($) { bless [$_[0], 0, undef], CBOR::XS::Tagged:: } |
758 | sub CBOR::XS::as_cbor ($) { bless [$_[0], 0, undef], CBOR::XS::Tagged:: } |
764 | sub CBOR::XS::as_cbor ($) { bless [$_[0], 1, undef], CBOR::XS::Tagged:: } |
759 | sub CBOR::XS::as_bytes ($) { bless [$_[0], 1, undef], CBOR::XS::Tagged:: } |
765 | sub CBOR::XS::as_bytes ($) { bless [$_[0], 2, undef], CBOR::XS::Tagged:: } |
760 | sub CBOR::XS::as_text ($) { bless [$_[0], 2, undef], CBOR::XS::Tagged:: } |
766 | sub CBOR::XS::as_text ($) { bless [$_[0], 3, undef], CBOR::XS::Tagged:: } |
761 | sub CBOR::XS::as_float16 ($) { bless [$_[0], 3, undef], CBOR::XS::Tagged:: } |
767 | sub CBOR::XS::as_float16 ($) { bless [$_[0], 4, undef], CBOR::XS::Tagged:: } |
762 | sub CBOR::XS::as_float32 ($) { bless [$_[0], 4, undef], CBOR::XS::Tagged:: } |
768 | sub CBOR::XS::as_float32 ($) { bless [$_[0], 5, undef], CBOR::XS::Tagged:: } |
763 | sub CBOR::XS::as_float64 ($) { bless [$_[0], 5, undef], CBOR::XS::Tagged:: } |
769 | sub CBOR::XS::as_float64 ($) { bless [$_[0], 6, undef], CBOR::XS::Tagged:: } |
764 | |
770 | |
765 | =head2 OBJECT SERIALISATION |
771 | =head2 OBJECT SERIALISATION |
766 | |
772 | |
767 | This module implements both a CBOR-specific and the generic |
773 | This module implements both a CBOR-specific and the generic |
768 | L<Types::Serialier> object serialisation protocol. The following |
774 | L<Types::Serialier> object serialisation protocol. The following |