--- Types-Serialiser/Serialiser.pm 2013/10/29 18:33:11 1.7 +++ Types-Serialiser/Serialiser.pm 2013/11/04 15:12:16 1.8 @@ -159,7 +159,7 @@ For historical reasons, the C stash is just an alias for C. When printed, the classname -withh usually be C, but isa tests and stash pointer +with usually be C, but isa tests and stash pointer comparison will normally work correctly (i.e. Types::Serialiser::true ISA JSON::PP::Boolean, but also ISA Types::Serialiser::Boolean). @@ -179,11 +179,10 @@ attempt to use the special C serialisation protocol), it will look up the C method on the object. -If it exists, it will call it with two arguments: the object to -serialise, and a constant string that indicates the name of the -serialisationformat. For example L uses C, and L and -L (or any other JSON serialiser), would use C as second -argument. +If it exists, it will call it with two arguments: the object to serialise, +and a constant string that indicates the name of the data model or data +format. For example L uses C, and L and L +(or any other JSON serialiser), would use C as second argument. The C method can then return zero or more values to identify the object instance. The serialiser is then supposed to encode the class name @@ -195,14 +194,14 @@ that calls it. Therefore, it is recommended to use simple types such as strings and numbers, and maybe array references and hashes (basically, the JSON data model). You can always use a more complex format for a specific -serialiser by checking the second argument. +data model by checking the second argument. =head2 DECODING When the decoder then encounters such an encoded perl object, it should look up the C method on the stored classname, and invoke it with the -classname, the constant string to identify the format, and all the return -values returned by C. +classname, the constant string to identify the data model/data format, and +all the return values returned by C. =head2 EXAMPLES @@ -212,13 +211,13 @@ Here is an example C/C method pair: sub My::Object::FREEZE { - my ($self, $serialiser) = @_; + my ($self, $model) = @_; ($self->{type}, $self->{id}, $self->{variant}) } sub My::Object::THAW { - my ($class, $serialiser, $type, $id, $variant) = @_; + my ($class, $model, $type, $id, $variant) = @_; $class->new (type => $type, id => $id, variant => $variant) }