Here's some code some people in #kiokudb came up with for an example model for Catalyst:
I'm sorely tempted to start writing backends for Catalyst::Plugin::Authentication. I *really* want to use this for OTBAN.
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.







Leave a comment