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.1 by root, Fri Oct 25 23:09:45 2013 UTC vs.
Revision 1.3 by root, Sat Oct 26 11:08:34 2013 UTC

32 32
33package CBOR::XS; 33package CBOR::XS;
34 34
35use common::sense; 35use common::sense;
36 36
37our $VERSION = 0.01; 37our $VERSION = 0.02;
38our @ISA = qw(Exporter); 38our @ISA = qw(Exporter);
39 39
40our @EXPORT = qw(encode_cbor decode_cbor); 40our @EXPORT = qw(encode_cbor decode_cbor);
41 41
42use Exporter; 42use Exporter;
43use XSLoader; 43use XSLoader;
44
45our $MAGIC = "\xd9\xd9\xf7";
44 46
45=head1 FUNCTIONAL INTERFACE 47=head1 FUNCTIONAL INTERFACE
46 48
47The following convenience methods are provided by this module. They are 49The following convenience methods are provided by this module. They are
48exported by default: 50exported by default:
168These CBOR values become C<CBOR::XS::true> and C<CBOR::XS::false>, 170These CBOR values become C<CBOR::XS::true> and C<CBOR::XS::false>,
169respectively. They are overloaded to act almost exactly like the numbers 171respectively. They are overloaded to act almost exactly like the numbers
170C<1> and C<0>. You can check whether a scalar is a CBOR boolean by using 172C<1> and C<0>. You can check whether a scalar is a CBOR boolean by using
171the C<CBOR::XS::is_bool> function. 173the C<CBOR::XS::is_bool> function.
172 174
173=item null 175=item Null, Undefined
174 176
175A CBOR Null value becomes C<undef> in Perl. 177CBOR Null and Undefined values becomes C<undef> in Perl (in the future,
178Undefined may raise an exception).
176 179
177=back 180=back
178 181
179 182
180=head2 PERL -> CBOR 183=head2 PERL -> CBOR
258extensions to the floating point numbers of your platform, such as 261extensions to the floating point numbers of your platform, such as
259infinities or NaN's - these cannot be represented in CBOR, and it is an 262infinities or NaN's - these cannot be represented in CBOR, and it is an
260error to pass those in. 263error to pass those in.
261 264
262=back 265=back
266
267
268=head2 MAGIC HEADER
269
270There is no way to distinguish CBOR from other formats
271programmatically. To make it easier to distinguish CBOR from other
272formats, the CBOR specification has a special "magic string" that can be
273prepended to any CBOR string without changing it's meaning.
274
275This string is available as C<$CBOR::XS::MAGIC>. This module does not
276prepend this string tot he CBOR data it generates, but it will ignroe it
277if present, so users can prepend this string as a "file type" indicator as
278required.
263 279
264 280
265=head2 CBOR and JSON 281=head2 CBOR and JSON
266 282
267TODO 283TODO

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines