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.77 by root, Fri Dec 4 02:57:14 2020 UTC vs.
Revision 1.79 by root, Fri Dec 11 06:03:40 2020 UTC

64 64
65package CBOR::XS; 65package CBOR::XS;
66 66
67use common::sense; 67use common::sense;
68 68
69our $VERSION = 1.82; 69our $VERSION = 1.83;
70our @ISA = qw(Exporter); 70our @ISA = qw(Exporter);
71 71
72our @EXPORT = qw(encode_cbor decode_cbor); 72our @EXPORT = qw(encode_cbor decode_cbor);
73 73
74use Exporter; 74use Exporter;
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
715CBOR encoder function. 715CBOR encoder function.
716 716
717The following casts are currently available (all of which are unary operators): 717The following casts are currently available (all of which are unary
718operators, that is, have a prototype of C<$>):
718 719
719=over 720=over
720 721
721=item CBOR::XS::as_int $value 722=item CBOR::XS::as_int $value
722 723
792sub CBOR::XS::as_bool ($) { $_[0] ? $Types::Serialiser::true : $Types::Serialiser::false } 793sub CBOR::XS::as_bool ($) { $_[0] ? $Types::Serialiser::true : $Types::Serialiser::false }
793 794
794sub CBOR::XS::as_map ($) { 795sub CBOR::XS::as_map ($) {
795 ARRAY:: eq ref $_[0] 796 ARRAY:: eq ref $_[0]
796 and $#{ $_[0] } & 1 797 and $#{ $_[0] } & 1
797 or do { require Carp; Carp::croak ("CBOR::XS::as_map only acepts array references with an even number of elements, found ") }; 798 or do { require Carp; Carp::croak ("CBOR::XS::as_map only acepts array references with an even number of elements, caught") };
798 799
799 bless [$_[0], 7, undef], CBOR::XS::Tagged:: 800 bless [$_[0], 7, undef], CBOR::XS::Tagged::
800} 801}
801 802
802=head2 OBJECT SERIALISATION 803=head2 OBJECT SERIALISATION

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines