Catmandu::Serializer(3pm) | User Contributed Perl Documentation | Catmandu::Serializer(3pm) |
Catmandu::Serializer - Base class for all Catmandu Serializers
package Catmandu::Serializer::Foo; use Moo; sub serialize { my ($self,$data) = @_; .. transform the data to a string and return it... } sub deserialize { my ($self,$string) = @_; ... transform the string into a perl hash ... } package MyPackage; use Moo; with 'Catmandu::Serializer'; package main; my $pkg = MyPackage->new; my $string = $pkg->serialize({ foo => 'bar' }); my $perl = $pkg->deserialize($string); # Using Catmandu::Serializer::Foo my $pkg = MyPackage->new( serialization_format => 'Foo' ); my $string = $pkg->serialize({ foo => 'bar' }); my $perl = $pkg->deserialize($string);
This is a convience class to send Perl hashes easily over the wire without having to instantiate a Catmandu::Importer and Catmandu::Exporter which are more suited for processing IO streams.
The name of the package that serializes data.
An instance of the package that serializes.
Serialize a perl data structure into a string.
Deserialize bytes into a perl data structure.
Catmandu::Store::DBI, Catmandu::Serializer::json, Catmandu::Serializer::storabe, Catmandu::Serializer::messagepack
2023-03-03 | perl v5.36.0 |