=head1 REGISTRATION INFORMATION Tag Data Item array [classname, constructargs...] Semantics Serialised Perl object with classname and constructor arguments Reference http://cbor.schmorp.de/perl-object Contact Marc A. Lehmann =head1 DESCRIPTION The perl-object tag in CBOR can be used to serialise Perl 5 objects into CBOR. The tagged value must be a CBOR array with at least one element. The first element specifies a classname to use in Perl (it can, but does not need to be a string). The encoder and decoder should serialise/deserialise the object using the Types::Serialiser object serialisation protocol. For this, the object's class must have FREEZE and THAW methods that are called like this: @constructargs = $object->FREEZE ("CBOR"); $object = $class->THAW ("CBOR", @constructargs); If the class or method is currently not available, the decoder may try to load a Perl module of the same name and retry the method call. =head1 EXAMPLES Example of a hypothetical My::DateTime representation using a unix timestamp: tag(["My::DateTime", 12345678]) Example of the corresponding FREEZE method: sub My::DateTime::FREEZE { my ($self, $model) = @_; $self->as_seconds } Example of the corresponding THAW method: sub My::DateTime::THAW { my ($class, $model, $seconds) = @_; $class->new_from_seconds ($seconds) }