… | |
… | |
124 | These CBOR values become "CBOR::XS::true" and "CBOR::XS::false", |
124 | These CBOR values become "CBOR::XS::true" and "CBOR::XS::false", |
125 | respectively. They are overloaded to act almost exactly like the |
125 | respectively. They are overloaded to act almost exactly like the |
126 | numbers 1 and 0. You can check whether a scalar is a CBOR boolean by |
126 | numbers 1 and 0. You can check whether a scalar is a CBOR boolean by |
127 | using the "CBOR::XS::is_bool" function. |
127 | using the "CBOR::XS::is_bool" function. |
128 | |
128 | |
129 | null |
129 | Null, Undefined |
130 | A CBOR Null value becomes "undef" in Perl. |
130 | CBOR Null and Undefined values becomes "undef" in Perl (in the |
|
|
131 | future, Undefined may raise an exception). |
131 | |
132 | |
132 | PERL -> CBOR |
133 | PERL -> CBOR |
133 | The mapping from Perl to CBOR is slightly more difficult, as Perl is a |
134 | The mapping from Perl to CBOR is slightly more difficult, as Perl is a |
134 | truly typeless language, so we can only guess which CBOR type is meant |
135 | truly typeless language, so we can only guess which CBOR type is meant |
135 | by a Perl value. |
136 | by a Perl value. |
… | |
… | |
198 | binary to decimal conversion follows the same rules as in Perl, |
199 | binary to decimal conversion follows the same rules as in Perl, |
199 | which can differ to other languages). Also, your perl interpreter |
200 | which can differ to other languages). Also, your perl interpreter |
200 | might expose extensions to the floating point numbers of your |
201 | might expose extensions to the floating point numbers of your |
201 | platform, such as infinities or NaN's - these cannot be represented |
202 | platform, such as infinities or NaN's - these cannot be represented |
202 | in CBOR, and it is an error to pass those in. |
203 | in CBOR, and it is an error to pass those in. |
|
|
204 | |
|
|
205 | MAGIC HEADER |
|
|
206 | There is no way to distinguish CBOR from other formats programmatically. |
|
|
207 | To make it easier to distinguish CBOR from other formats, the CBOR |
|
|
208 | specification has a special "magic string" that can be prepended to any |
|
|
209 | CBOR string without changing it's meaning. |
|
|
210 | |
|
|
211 | This string is available as $CBOR::XS::MAGIC. This module does not |
|
|
212 | prepend this string tot he CBOR data it generates, but it will ignroe it |
|
|
213 | if present, so users can prepend this string as a "file type" indicator |
|
|
214 | as required. |
203 | |
215 | |
204 | CBOR and JSON |
216 | CBOR and JSON |
205 | TODO |
217 | TODO |
206 | |
218 | |
207 | SECURITY CONSIDERATIONS |
219 | SECURITY CONSIDERATIONS |