logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

KiokuDB::Backend::Serialize - Serialization role for backends

Author

       Yuval Kogman <nothingmuch@woobling.org>

Description

       This role provides provides a consistent way to use serialization modules to handle backend
       serialization.

       See KiokuDB::Backend::Serialize::Storable, KiokuDB::Backend::Serialize::YAML and
       KiokuDB::Backend::Serialize::JSON for examples.

Name

       KiokuDB::Backend::Serialize - Serialization role for backends

Required Methods

       serializate $entry
           Takes a KiokuDB::Entry as an argument. Should return a value suitable for storage by the backend.

       deserialize $blob
           Takes whatever "serializate" returned and should inflate and return a KiokuDB::Entry.

Synopsis

           package KiokuDB::Backend::Serialize::Foo;
           use Moose::Role;

           use Foo;

           use namespace::clean -except => 'meta';

           with qw(KiokuDB::Backend::Serialize);

           sub serialize {
               my ( $self, $entry ) = @_;

               Foo::serialize($entry)
           }

           sub deserialize {
               my ( $self, $blob ) = @_;

               Foo::deserialize($blob);
           }

Version

       version 0.57

See Also