KiokuD...rialize(3pm)

πŸ“¦
version 0.57 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– KiokuDB::Backend::Serialize πŸ’–

okay bestie, gather round β€” this is the KiokuD...rialize(3pm) page, aka the serialization role for backends, and it is lowkey the glue that makes your backend know how to turn entries into blobs and back again. ✨


🌸 NAME 🌸

KiokuDB::Backend::Serialize β€” the serialization role for backends. that's it, that's the name, slay. πŸ’…


πŸŽ€ VERSION πŸŽ€

version 0.57 ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole vibe, copy it, love it, make it yours:

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);
}

see how chill that is?? you write two subs, you with the role, you're done. no cap. 🫢


🌈 DESCRIPTION 🌈

so this role provides provides a consistent way to use serialization modules to handle backend serialization. (yes, "provides provides" β€” we don't fix it, we respect it, iykyk 😭)

if you want to see this energy in the wild, go look at:

  • KiokuDB::Backend::Serialize::Storable
  • KiokuDB::Backend::Serialize::YAML
  • KiokuDB::Backend::Serialize::JSON

those are the examples, bestie. go peek. πŸ‘€


πŸ‘‘ REQUIRED METHODS πŸ‘‘

if you with this role you MUST bring these two. it's giving main character obligations. πŸ’…

  • serializate $entry β€” takes a KiokuDB::Entry as an argument. should return a value suitable for storage by the backend. yes it's spelled serializate and yes that's the spelling in the docs, we are simply reporting the facts πŸ’€
  • deserialize $blob β€” takes whatever serializate returned and should inflate and return a KiokuDB::Entry. glow-up in reverse, it un-serializes the blob back into a whole entry ✨
🚨 bestie warning: these two are the contract. serializate gives you something storable, deserialize gives you a KiokuDB::Entry back. if you don't implement both, the role will not be happy with you. fr fr.

🧚 AUTHOR 🧚

Yuval Kogman <nothingmuch@woobling.org> β€” iconic, ate, left no crumbs. 🌟


This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.

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


and that's the whole page, you're officially caught up πŸŽ€ β€” this lil' doc came to you courtesy of perl v5.34.0, dated 2022-05-23, and it lives under the name KiokuD...rialize(3pm). mwah, go serialize something gorgeous πŸ’–βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from