KiokuDB model for Catalyst example

| No Comments | No TrackBacks
Here's some code some people in #kiokudb came up with for an example model for Catalyst:


package My::App::Model::Kioku;
use Moose;
use My::App::Backend::Kioku;

has 'backend' => (
    is       => 'ro',
    isa      => 'My::App::Backend::Kioku',
    required => 1,
);

sub COMPONENT {
    my ($self, $app, $args) = @_;
    $self->new(
        backend => My::App::Backend::Kioku->new(
            %$args,
        ),
    );
}

sub ACCEPT_CONTEXT {
    my ($self, $c, @args) = @_;
    my $be = $self->backend;
    $c->stash->{__kioku_scope} ||= $be->db->new_scope;
    return $be;
}

1;


I'm sorely tempted to start writing backends for Catalyst::Plugin::Authentication. I *really* want to use this for OTBAN.

No TrackBacks

TrackBack URL: http://www.codedright.net/mt/mt-tb.fcgi/21

Leave a comment

About this Entry

This page contains a single entry by Devin published on February 25, 2009 7:33 PM.

KiokuDB: looks seriously cool was the previous entry in this blog.

Some entertainment is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Recent Photos

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.261