KiokuDB::TypeMap(3pm)

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

πŸ’– KiokuDB::TypeMap πŸ’–

okay bestie, come sit with me, we're reading the KiokuDB::TypeMap(3pm) page together and honestly? it's giving very demure, very mindful, very "the glue that holds your whole object graph together" πŸ’…

VERSION: version 0.57 β€” yes she has a version number, she's official ✨


✨ SYNOPSIS ✨

look at her, she's so clean:

use KiokuDB::TypeMap;

KiokuDB::TypeMap->new(
    entries => {
        'Foo' => KiokuDB::TypeMap::Entry::Naive->new,
    },
    isa_entries => {
        'My::Class' => KiokuDB::TypeMap::Entry::Naive->new,
    },
    includes => [
        $typemap_foo,
        $typemap_bar,
    ],
);

like, constructor with some hashes and a list, that's the whole vibe πŸ¦‹


🌸 DESCRIPTION 🌸

so what IS this thing. the KiokuDB typemap maps classes to KiokuDB::TypeMap::Entry objects. that's the whole job. class in, entry out, no cap.

the mapping is by class, and entries can be keyed normally (that means using "ref $object" equality, so the literal class of the thing) or by filtering on "$object->isa($class)", which is the "isa_entries" situation. one is "is this exactly you", the other is "are you one of these" πŸŽ€


πŸ‘‘ ATTRIBUTES πŸ‘‘

  • entries β€” a hash of normal entries. the straightforward girlies.
  • isa_entries β€” a hash of "$object->isa" based entries. for when you're matching by ancestry and not by exact identity 🌈
  • includes β€” a list of parent typemaps to inherit entries from. yes she does inherit, she's generous like that πŸ’œ

πŸ”₯ METHODS πŸ”₯

  • resolve $class β€” give her a class and she hands you back the "KiokuDB::TypeMap::Entry" object that corresponds to that class. oh and heads up, this one is called by KiokuDB::TypeMap::Resolver, so it's doing main character work behind the scenes ⭐
  • resolve_entry $entry β€” if the entry is an alias, she resolves it recursively. if it's not an alias, she just returns it. simple as that, no drama πŸ™ˆ
  • all_entries β€” returns the merged "entries" from this typemap and all the included typemaps. everyone's invited to this party πŸ“
  • all_isa_entries β€” same energy, but returns the merged "isa_entries" from this typemap and all the included typemaps πŸ’–
  • all_isa_entry_classes β€” an array reference of all the classes in "all_isa_entries", sorted from least derived to most derived. so like, grandma class first, most-evolved grandbaby class last, the whole family tree in order 🌸

🫢 AUTHOR 🫢

Yuval Kogman <nothingmuch@woobling.org> β€” thank you for your service, king πŸ‘‘


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, open source fr fr πŸ’–


okay that's the whole page bestie, you ate that. this was perl v5.34.0, dated 2022-05-23, and you just finished reading KiokuDB::TypeMap(3pm). go forth and map some types, ily, bye πŸ§šβœ¨πŸ’œ

πŸ“¦ where this page comes from