KiokuD...ole::ID(3pm)

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

πŸ’– KiokuDB::Role::ID πŸ’–

okay so bestie, welcome to KiokuDB::Role::ID(3pm) β€” a Perl role straight out of the User Contributed Perl Documentation, and honestly? it's giving "i pick my own destiny" energy. ✨


🌸 NAME 🌸

KiokuDB::Role::ID β€” a role for objects who choose their own ID. periodt. you don't get to hand them a name, they already know who they are πŸ’…


πŸŽ€ VERSION πŸŽ€

version 0.57 β€” yes, we're living in the 0.57 era, iconic, no notes 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

like, here's the vibe in code, bestie:

# typically you set up your own ID role, and map the C<kiokudb_object_id>
# method to your schema's ID

package MySchema::ID;
use Moose::Role;

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

sub kiokudb_object_id { shift->id };

requires "id";

package MySchema::Foo;
use Moose;

with qw(MySchema::ID);

sub id { ... }

so real talk: usually you make your own ID role, then map the kiokudb_object_id method over to whatever your schema calls an ID. very demure, very mindful, very modular. 🧚


✨ DESCRIPTION ✨

This role provides a way for objects to determine their own IDs. main character energy fr fr πŸ‘‘

You must implement or alias the kiokudb_object_id method to return a string. that's not optional, that's the whole deal, that's the assignment. 😭


🌈 REQUIRED METHODS 🌈

  • kiokudb_object_id β€” should return a string to be used as the ID of the object. like, a string string. that's the one job. do it. πŸ’œ

πŸ’« AUTHOR πŸ’«

Yuval Kogman <nothingmuch@woobling.org> β€” shoutout to the legend who wrote this 🫑


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. slay, that's the good license, the one that actually lets you do stuff 🌸


okay that's the whole page bestie, go forth and let your objects name themselves πŸ’–

and a lil sign-off for you: this one's from perl v5.34.0, dated 2022-05-23 πŸŽ€ mwah, bye!! πŸ’…βœ¨

πŸ“¦ where this page comes from