KiokuX::Model(3pm) | User Contributed Perl Documentation | KiokuX::Model(3pm) |
KiokuX::Model - A simple application specific wrapper for KiokuDB.
# 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<Catalyst::Model::KiokuDB>: $c->model("kiokudb");
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.
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.
Created using the other attributes at "BUILD" time.
This attribute has delegations set up for all the methods of the KiokuDB class.
Can be a hash reference or an array reference.
KiokuDB, KiokuDB::Role::API, Catalyst::Model::KiokuDB
KiokuDB is maintained using Git. Information about the repository is available on <http://www.iinteractive.com/kiokudb/>
Yuval Kogman <nothingmuch@woobling.org>
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.
=
2022-06-15 | perl v5.34.0 |