--- CBOR-XS/XS.pm 2020/11/30 18:30:29 1.74 +++ CBOR-XS/XS.pm 2020/11/30 20:38:25 1.75 @@ -731,6 +731,13 @@ Forces the value to be encoded as a (binary) string value. +=item CBOR::XS::as_bool $value + +Converts a Perl boolean (which can be any kind of scalar) into a CBOR +boolean. Exactly the same, but shorter to write, than: + + $value ? Types::Serialiser::true : Types::Serialiser::false + =item CBOR::XS::as_float16 $value Forces half-float (IEEE 754 binary16) encoding of the given value. @@ -768,6 +775,8 @@ sub CBOR::XS::as_float32 ($) { bless [$_[0], 5, undef], CBOR::XS::Tagged:: } sub CBOR::XS::as_float64 ($) { bless [$_[0], 6, undef], CBOR::XS::Tagged:: } +sub CBOR::XS::as_bool ($) { $_[0] ? Types::Serialiser::true : Types::Serialiser::false } + =head2 OBJECT SERIALISATION This module implements both a CBOR-specific and the generic