KiokuD...utable(3pm)

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

πŸ’– KiokuDB::Role::Immutable πŸ’–

okay so bestie, welcome to the manual page for KiokuDB::Role::Immutable β€” a Perl role from the KiokuDB universe, filed under User Contributed Perl Documentation. it's giving "I will literally never change and that's on purpose". let's get into it πŸ¦‹


✨ NAME ✨

KiokuDB::Role::Immutable β€” a role for objects that are never updated. periodt. no takebacks, no glow-ups, no edits. πŸ’…


🌸 VERSION 🌸

version 0.57 β€” yeah she's got a version number, we love a documented queen πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

so you just roll it into your class like this:

with qw(KiokuDB::Role::Immutable);

that's it. that's the whole vibe. you with it and now your object is ✨frozen✨ (conceptually, not literally, keep reading bestie). 🧚


πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea β˜• β€” this is a role for objects that are never updated after they are inserted to the database. once they're in, they're in. no cap.

the way that this works is lowkey iconic: the object gets skipped entirely on all update/store operations β€” unless it's being collapsed for the first time. and its child objects? those won't get updated either, unless they're found while collapsing another object. so like, the immutability kinda radiates outward. 🌈

and this means that (and I cannot stress this enough, bestie, write this down):

my $immutable = $kiokudb->lookup($id);

$immutable->child->name("foo");

$kiokudb->update($immutable);
this will NOT work. πŸ’€ the update just bounces right off your immutable little guy. it's giving "talking to a wall" energy. 😭

so what do you do instead? you gotta update the child directly, like this:

$kiokudb->update($immutable->child);

yeah. you go straight to the source. the parent is not your messenger, she does not pass notes. 🫢


🌟 AUTHOR 🌟

Yuval Kogman <nothingmuch@woobling.org> β€” the icon, the legend, the one who wrote this. bow down πŸ‘‘


this software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive. πŸ“

it's free software, bestie β€” you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so like, go forth and share, responsibly. ✨


and that's the whole page, babe! πŸŽ€ this beauty came from the perl v5.34.0 docs, dated 2022-05-23, and if you ever see the header or footer around, it's KiokuD...utable(3pm) β€” yes the title got truncated, it's fine, we don't talk about it πŸ™ˆ. now go forth and never update your objects. slay πŸ’…πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from