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
To install Catmandu, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catmandu
CPAN shell
perl -MCPAN -e shell install Catmandu
For more information on module installation, please visit the detailed CPAN module installation guide.