ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/doc/perl-object.pod
(Generate patch)

Comparing CBOR-XS/doc/perl-object.pod (file contents):
Revision 1.1 by root, Tue Nov 26 09:43:39 2013 UTC vs.
Revision 1.3 by root, Tue Dec 27 21:24:33 2016 UTC

1=head1 REGISTRATION INFORMATION 1=head1 REGISTRATION INFORMATION
2 2
3 Tag <unassigned> 3 Tag 26
4 Data Item array [classname, constructargs...] 4 Data Item array [classname, constructargs...]
5 Semantics Serialised Perl object with classname and constructor arguments 5 Semantics Serialised Perl object with classname and constructor arguments
6 Reference http://cbor.schmorp.de/perl-object 6 Reference http://cbor.schmorp.de/perl-object
7 Contact Marc A. Lehmann <cbor@schmorp.de> 7 Contact Marc A. Lehmann <cbor@schmorp.de>
8 8
10 10
11The perl-object tag in CBOR can be used to serialise Perl 5 objects into 11The perl-object tag in CBOR can be used to serialise Perl 5 objects into
12CBOR. 12CBOR.
13 13
14The tagged value must be a CBOR array with at least one element. The first 14The tagged value must be a CBOR array with at least one element. The first
15element specifies a classname to use in Perl (it can, but does not need 15element specifies a classname to use in Perl (it can, but does not need to
16to be a string). 16be a string - the stringified form will be used as classname).
17 17
18The encoder and decoder should serialise/deserialise the object using the 18The encoder and decoder should serialise/deserialise the object using the
19Types::Serialiser object serialisation protocol. For this, the object's 19Types::Serialiser object serialisation protocol. For this, the object's
20class must have FREEZE and THAW methods that are called like this: 20class must have FREEZE and THAW methods that are called like this:
21 21
28=head1 EXAMPLES 28=head1 EXAMPLES
29 29
30Example of a hypothetical My::DateTime representation using a unix 30Example of a hypothetical My::DateTime representation using a unix
31timestamp: 31timestamp:
32 32
33 tag(["My::DateTime", 12345678]) 33 26(["My::DateTime", 12345678])
34
35 d8 1a # tag(26)
36 82 # array(2)
37 6c # text(12)
38 4d793a3a4461746554696d65 # "My::DateTime"
39 1a 00bc614e # unsigned(12345678)
34 40
35Example of the corresponding FREEZE method: 41Example of the corresponding FREEZE method:
36 42
37 sub My::DateTime::FREEZE { 43 sub My::DateTime::FREEZE {
38 my ($self, $model) = @_; 44 my ($self, $model) = @_;
46 my ($class, $model, $seconds) = @_; 52 my ($class, $model, $seconds) = @_;
47 53
48 $class->new_from_seconds ($seconds) 54 $class->new_from_seconds ($seconds)
49 } 55 }
50 56
57=head1 IMPLEMENTATIONS
58
59This section lists known implementations of this extension (L<drop me a
60mail|mailto:cbor@schmorp.de?Subject=CBOR-perl-object> if you want to be
61listed here).
62
63=over 4
64
65=item * [Perl] L<CBOR::XS|http://software.schmorp.de/pkg/CBOR-XS.html> (reference implementation)
66
67=back
68

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines