NAME

Kelp::Module::Sereal - Sereal encoder / decoder for Kelp

SYNOPSIS

# in config
modules => [qw(Sereal)],
modules_init => {
	Sereal => {
		encoder => {
			# encoder options
		},
		decoder => {
			# decoder options
		},
	},
},

# in your application
my $encoded = $self->sereal->encode({
	type => 'structure',
	name => [qw(testing sereal)],
});

# Kelp 2.10 encoder factory
my $new_sereal = $self->get_encoder(sereal => 'name');

DESCRIPTION

This is a very straightforward module that integrates the Kelp framework with the Sereal serialization protocol. See Sereal::Encoder and Sereal::Decoder for a full reference on the encoder and the decoder.

This module is compatible with Kelp 2.10 encoders feature, so you can use it as a factory for Sereal encoders by calling get_encoder on the Kelp app object. It registers itself under the name sereal.

METHODS INTRODUCED TO KELP

sereal

my $sereal_module = $kelp->sereal;

Returns the instance of an encoder facade. You can use this instance to invoke the methods listed below.

METHODS

encode

my $encoded = $kelp->sereal->encode($data);

A shortcut to $kelp->sereal->encoder->encode

encoder

my $encoder_instance = $kelp->sereal->encoder;

Returns the instance of Sereal::Encoder

decode

my $decoded = $kelp->sereal->decode($sereal_string);

A shortcut to $kelp->sereal->decoder->decode

decoder

my $decoder_instance = $kelp->sereal->decoder;

Returns the instance of Sereal::Decoder

CONFIGURATION

encoder

A hashref with all the arguments to "new" in Sereal::Encoder.

decoder

A hashref with all the arguments to "new" in Sereal::Decoder.

SEE ALSO

  • Kelp, the framework

  • Sereal, the wrapper for the encoder / decoder

AUTHOR

Bartosz Jarzyna, <bbrtj.pro@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2021 - 2024 by Bartosz Jarzyna

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.