… | |
… | |
32 | |
32 | |
33 | package CBOR::XS; |
33 | package CBOR::XS; |
34 | |
34 | |
35 | use common::sense; |
35 | use common::sense; |
36 | |
36 | |
37 | our $VERSION = 0.01; |
37 | our $VERSION = 0.02; |
38 | our @ISA = qw(Exporter); |
38 | our @ISA = qw(Exporter); |
39 | |
39 | |
40 | our @EXPORT = qw(encode_cbor decode_cbor); |
40 | our @EXPORT = qw(encode_cbor decode_cbor); |
41 | |
41 | |
42 | use Exporter; |
42 | use Exporter; |
43 | use XSLoader; |
43 | use XSLoader; |
|
|
44 | |
|
|
45 | our $MAGIC = "\xd9\xd9\xf7"; |
44 | |
46 | |
45 | =head1 FUNCTIONAL INTERFACE |
47 | =head1 FUNCTIONAL INTERFACE |
46 | |
48 | |
47 | The following convenience methods are provided by this module. They are |
49 | The following convenience methods are provided by this module. They are |
48 | exported by default: |
50 | exported by default: |
… | |
… | |
259 | extensions to the floating point numbers of your platform, such as |
261 | extensions to the floating point numbers of your platform, such as |
260 | infinities or NaN's - these cannot be represented in CBOR, and it is an |
262 | infinities or NaN's - these cannot be represented in CBOR, and it is an |
261 | error to pass those in. |
263 | error to pass those in. |
262 | |
264 | |
263 | =back |
265 | =back |
|
|
266 | |
|
|
267 | |
|
|
268 | =head2 MAGIC HEADER |
|
|
269 | |
|
|
270 | There is no way to distinguish CBOR from other formats |
|
|
271 | programmatically. To make it easier to distinguish CBOR from other |
|
|
272 | formats, the CBOR specification has a special "magic string" that can be |
|
|
273 | prepended to any CBOR string without changing it's meaning. |
|
|
274 | |
|
|
275 | This string is available as C<$CBOR::XS::MAGIC>. This module does not |
|
|
276 | prepend this string tot he CBOR data it generates, but it will ignroe it |
|
|
277 | if present, so users can prepend this string as a "file type" indicator as |
|
|
278 | required. |
264 | |
279 | |
265 | |
280 | |
266 | =head2 CBOR and JSON |
281 | =head2 CBOR and JSON |
267 | |
282 | |
268 | TODO |
283 | TODO |