.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "KiokuX::Model 3pm" .TH KiokuX::Model 3pm 2024-03-06 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME KiokuX::Model \- A simple application specific wrapper for KiokuDB. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& # start with the base class: \& \& KiokuX::Model\->new( dsn => "bdb:dir=/var/myapp/db" ); \& \& \& \& # later you can add convenience methods by subclassing: \& \& package MyApp::DB; \& use Moose; \& \& extends qw(KiokuX::Model); \& \& sub add_user { \& my ( $self, @args ) = @_; \& \& my $user = MyApp::User\->new(@args); \& \& $self\->txn_do(sub { \& $self\->insert($user); \& }); \& \& return $user; \& } \& \& \& # Then just use it like this: \& \& MyApp::DB\->new( dsn => "bdb:dir=/var/myapp/db" ); \& \& # or automatically using e.g. L: \& \& $c\->model("kiokudb"); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This base class makes it easy to create KiokuDB database instances in your application. It provides a standard way to instantiate and use a KiokuDB object in your apps. .PP As your app grows you can subclass it and provide additional convenience methods, without changing the structure of the code, but simply swapping your subclass for KiokuX::Model in e.g. Catalyst::Model::KiokuDB or whatever you use to glue it in. .SH ATTRIBUTES .IX Header "ATTRIBUTES" .IP directory 4 .IX Item "directory" The instantiated directory. .Sp Created using the other attributes at \f(CW\*(C`BUILD\*(C'\fR time. .Sp This attribute has delegations set up for all the methods of the KiokuDB class. .IP dsn 4 .IX Item "dsn" e.g. \f(CW\*(C`bdb:dir=root/db\*(C'\fR. See "connect" in KiokuDB. .IP extra_args 4 .IX Item "extra_args" Additional arguments to pass to \f(CW\*(C`connect\*(C'\fR. .Sp Can be a hash reference or an array reference. .IP typemap 4 .IX Item "typemap" An optional custom typemap to add. See KiokuDB::Typemap and "typemap" in KiokuDB. .SH "SEE ALSO" .IX Header "SEE ALSO" KiokuDB, KiokuDB::Role::API, Catalyst::Model::KiokuDB .SH "VERSION CONTROL" .IX Header "VERSION CONTROL" KiokuDB is maintained using Git. Information about the repository is available on .SH AUTHOR .IX Header "AUTHOR" Yuval Kogman .SH COPYRIGHT .IX Header "COPYRIGHT" .Vb 3 \& Copyright (c) 2009 Yuval Kogman, Infinity Interactive. All \& rights reserved This program is free software; you can redistribute \& it and/or modify it under the same terms as Perl itself. .Ve .PP =