… | |
… | |
44 | Indirection tags can be nested - each additional level of nesting would |
44 | Indirection tags can be nested - each additional level of nesting would |
45 | indicate an additional indirection. |
45 | indicate an additional indirection. |
46 | |
46 | |
47 | =head1 EXAMPLES |
47 | =head1 EXAMPLES |
48 | |
48 | |
49 | <TBD> |
49 | The following Perl data structure is an array containing a reference to an |
|
|
50 | array, followed by a reference to a string: |
50 | |
51 | |
|
|
52 | [[], \"string"] |
|
|
53 | |
|
|
54 | Since Perl cannot have "naked" arrays or maps inside another data |
|
|
55 | structure, but only a reference to it, the natural encoding of this |
|
|
56 | data structure uses a normal array for the array-reference (i.e. it |
|
|
57 | omits the reference). The string reference is uncommon but valid, and |
|
|
58 | not the natural way to store a string inside another data structure. An |
|
|
59 | encoder might therefore chose to encode this string reference using the |
|
|
60 | indirection tag: |
|
|
61 | |
|
|
62 | 256([[], 22098("string")]) |
|
|
63 | |
|
|
64 | d9 0100 # tag(256) |
|
|
65 | 82 # array(2) |
|
|
66 | 80 # array(0) |
|
|
67 | d9 5652 # tag(22098) |
|
|
68 | 66 # text(6) |
|
|
69 | 737472696e67 # "string" |
|
|
70 | |
|
|
71 | =head1 IMPLEMENTATIONS |
|
|
72 | |
|
|
73 | This section lists known implementations of this extension (L<drop me a |
|
|
74 | mail|mailto:cbor@schmorp.de?Subject=CBOR-indirection> if you want to be |
|
|
75 | listed here). |
|
|
76 | |
|
|
77 | =over 4 |
|
|
78 | |
|
|
79 | =item * [Perl] L<CBOR::XS|http://software.schmorp.de/pkg/CBOR-XS.html> (reference implementation) |
|
|
80 | |
|
|
81 | =back |
|
|
82 | |