SerealX::Store - Sereal based persistence for Perl data structures
use SerealX::Store; my $st = SerealX::Store->new(); my $data = { foo => 1, bar => 'nut', baz => [1, 'barf'], qux => { a => 1, b => 'ugh' }, ugh => undef }; $st->store($data, "/tmp/dummy"); my $decoded = $st->retrieve("/tmp/dummy");
This module serializes Perl data structures using Sereal::Encoder and stores them on disk for the purpose of retrieving and using them at a later time. At retrieval Sereal::Decoder is used to deserialize the data.
The rationale behind this module is to eventually provide a Storable compatible API, while using the excellent Sereal protocol for the heavy lifting.
Constructor used to instantiate the object.
Given a Perl data structure and a path as arguments, will encode the data structure into a binary string using Sereal::Encoder and write it to a file at the specified path. The method will return a true value upon success or croak if no path is given or if any other errors are encountered.
$st->store($data, "/tmp/dummy");
Given a path as argument, will retrieve the data from the file at the specified path, deserialize it using Sereal::Decoder and return it. The method will croak upon failure.
$st->retrieve($data, "/tmp/dummy");
Sereal, Storable
Gelu Lupaş <gvl@cpan.org>
Copyright (c) 2013-2014 the Log::Any::Adapter::Handler "AUTHOR" as listed above.
This is free software, licensed under:
The MIT License (MIT)
To install SerealX::Store, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SerealX::Store
CPAN shell
perl -MCPAN -e shell install SerealX::Store
For more information on module installation, please visit the detailed CPAN module installation guide.