File Coverage

blib/lib/KiokuDB/Class.pm
Criterion Covered Total %
statement 2 4 50.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 4 6 66.6


line stmt bran cond sub pod time code
1             package KiokuDB::Class;
2             BEGIN {
3 1     1   24364 $KiokuDB::Class::AUTHORITY = 'cpan:NUFFIN';
4             }
5             $KiokuDB::Class::VERSION = '0.57';
6 1     1   1513 use Moose::Exporter;
  0            
  0            
7             # ABSTRACT: KiokuDB specific metaclass
8              
9             use Moose::Util::MetaRole;
10              
11             use KiokuDB::Meta::Instance;
12             use KiokuDB::Meta::Attribute::Lazy;
13              
14             use namespace::clean -except => 'meta';
15              
16             Moose::Exporter->setup_import_methods( also => 'Moose' );
17              
18             sub init_meta {
19             my ( $class, %args ) = @_;
20              
21             my $for_class = $args{for_class};
22              
23             Moose->init_meta(%args);
24              
25             Moose::Util::MetaRole::apply_metaroles(
26             for => $for_class,
27             class_metaroles => {
28             instance => [qw(KiokuDB::Meta::Instance)],
29             },
30             );
31              
32             return Class::MOP::get_metaclass_by_name($for_class);
33             }
34              
35             __PACKAGE__
36              
37             __END__
38              
39             =pod
40              
41             =encoding UTF-8
42              
43             =head1 NAME
44              
45             KiokuDB::Class - KiokuDB specific metaclass
46              
47             =head1 VERSION
48              
49             version 0.57
50              
51             =head1 SYNOPSIS
52              
53             package Foo;
54             use KiokuDB::Class; # instead of Moose
55              
56             has bar => (
57             traits => [qw(KiokuDB::Lazy)],
58             ...
59             );
60              
61             =head1 DESCRIPTION
62              
63             This L<Moose> wrapper provides some metaclass extensions in order to more
64             tightly integrate your class with L<KiokuDB>.
65              
66             Currently only L<KiokuDB::Meta::Attribute::Lazy> is set up (by extending
67             L<Moose::Meta::Instance> with a custom role to support it), but in the future
68             indexing, identity, and various optimizations will be supported by this.
69              
70             =head1 AUTHOR
71              
72             Yuval Kogman <nothingmuch@woobling.org>
73              
74             =head1 COPYRIGHT AND LICENSE
75              
76             This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.
77              
78             This is free software; you can redistribute it and/or modify it under
79             the same terms as the Perl 5 programming language system itself.
80              
81             =cut