KiokuD...ontent(3pm)
β¨ KiokuDB::Role::ID::Content π
okay bestie, welcome to KiokuDB::Role::ID::Content β it's giving Content dependent object IDs, and it's from the User Contributed Perl Documentation section of the manual (that's the 3pm vibe, iykyk) π«Ά
πΈ VERSION
version 0.57 β yes ma'am, that's the one β¨
π SYNOPSIS
package BLOB;
use Moose;
use Digest::SHA1;
with qw(KiokuDB::Role::ID::Content);
sub kiokudb_object_id {
my $self = shift;
sha1_hex($self->data);
}
has data => (
isa => "Str",
is => "ro",
required => 1,
);
like. look at it. with qw(KiokuDB::Role::ID::Content); and then boom, you define kiokudb_object_id yourself and the ID comes from the content. iconic behavior honestly π
π« DESCRIPTION
So here's the tea, bestie: this is a role for KiokuDB::Role::Immutable objects whose IDs depend on their content β or, in the cooler words, content addressable objects π
The canonical example? A string identified by its SHA-1 hash, exactly like the "SYNOPSIS" is showing off. chef's kiss, no notes π
Objects that do this role are never updated in the database β literally the same deal as KiokuDB::Role::Immutable objects. Once they're in, they're in. main character energy, they don't do rewrites π
And here's the little bonus that lowkey slays: it is not an error to insert such objects twice, because the objects are assumed to be identical. Double-inserting? Not a problem. The vibe check passes. β
π AUTHOR
Yuval Kogman <nothingmuch@woobling.org> β thank you for your service π«Ά
π¦ COPYRIGHT AND LICENSE
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. fr fr π
okay so that's the whole page, and for the cute sign-off: this lil doc is running on perl v5.34.0, dated 2022-05-23, and it lives in the manual as KiokuD...ontent(3pm) π bye bestie, go hash something πβ¨
π¦ where this page comes from
- debian bookworm: libkiokudb-perl 0.57-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libkiokudb-perl 0.57-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libkiokudb-perl 0.57-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libkiokudb-perl 0.57-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms