KiokuDB::Util(3pm)
π KiokuDB::Util π
okay so bestie, welcome to KiokuDB::Util β that's a 3pm man page, in case you were wondering, from the User Contributed Perl Documentation collection β¨ It's literally just a lil grab-bag of helper functions for working with KiokuDB, and it is so useful, I'm obsessed π«Ά
β¨ VERSION β¨
version 0.57 π
πΈ SYNOPSIS πΈ
use KiokuDB::Util qw(set weak_set);
my $set = set(@objects); # create a transient set
my $weak = weak_set(@objects); # to avoid circular refs
like. look at that. two lines and you're already slaying π
π¦ DESCRIPTION π¦
This module provides various helper functions for working with KiokuDB. that's it, that's the whole vibe β it's giving "utility belt" energy, no cap π₯
π EXPORTS π
okay so here's the tea, one bullet at a time π
dsn_to_backend $dsn, %args
Tries to parse $dsn, load the backend, and invoke "new" on it. fr fr, that's the whole job.
It's used by "connect" in KiokuDB and by the various command line interfaces. so if you've ever wondered who's behind the curtain on those, hi, it's this function π
set
weak_set
These two are besties and they do the same lil dance: instantiate a Set::Object or a Set::Object::Weak from the arguments, and then create a KiokuDB::Set::Transient with the result β¨
(so yes, set gives you the regular one and weak_set gives you the weak one β that's the difference, periodt πΈ)
import_yaml $kiokudb, @files_or_dirs
Loads YAML files with MooseX::YAML into the specified KiokuDB directory in a single transaction π₯ and if you hand it a directory instead of a file, it will be searched recursively for files with a ".yml" extension. so thorough. so iconic.
The YAML files can contain multiple documents, with each document treated as an object. and here's the cute part: if the YAML file contains a single non blessed array or hash, then that structure will be dereferenced as part of the arguments to "insert" π
Here's an example of an array of objects, plus a custom tag alias to make authoring the YAML file a lil easier for you:
%YAML 1.1
%TAG ! !MyFoo::
---
- !User
id: foo
real_name: Foo Bar
email: foo@myfoo.com
password: '{cleartext}test123'
and you can use a hash to specify custom IDs, like so:
%YAML 1.1
---
the_id: !Some::Class
attr: moose
see? custom IDs. main character energy π
π AUTHOR π
Yuval Kogman <nothingmuch@woobling.org> π«Ά
π 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. π
and that's the whole page, bestie!! this was KiokuDB::Util, documented for perl v5.34.0, dated 2022-05-23 β ty for coming to my ted talk, go forth and build transient sets responsibly πΈβ¨π
π¦ 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