NAME
KiokuDB::Util - Utility functions for working with KiokuDB
VERSION
version 0.57
SYNOPSIS
use KiokuDB::Util qw(set weak_set);my $set = set(@objects); # create a transient setmy $weak = weak_set(@objects); # to avoid circular refs
DESCRIPTION
This module provides various helper functions for working with KiokuDB.
EXPORTS
- dsn_to_backend $dsn, %args
-
Tries to parse
$dsn, load the backend and invoke"new"on it.Used by "connect" in KiokuDB and the various command line interfaces.
- set
- weak_set
-
Instantiate a Set::Object or Set::Object::Weak from the arguments, and then creates a KiokuDB::Set::Transient with the result.
- import_yaml $kiokudb, @files_or_dirs
-
Loads YAML files with MooseX::YAML (if given a directory it will be searched recursively for files with a
".yml"extension are) into the specified KiokuDB directory in a single transaction.The YAML files can contain multiple documents, with each document treated as an object. 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 is an example of an array of objects, and a custom tag alias to ease authoring of the YAML file:
%YAML 1.1%TAG ! !MyFoo::---- !Userid: fooreal_name: Foo Baremail: [email protected]password: '{cleartext}test123'You can use a hash to specify custom IDs:
%YAML 1.1---the_id: !Some::Classattr: moose
AUTHOR
Yuval Kogman <[email protected]>
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.