File Coverage

blib/lib/DBIx/Class/KiokuDB/EntryProxy.pm
Criterion Covered Total %
statement 18 20 90.0
branch 1 2 50.0
condition n/a
subroutine 6 7 85.7
pod 0 2 0.0
total 25 31 80.6


line stmt bran cond sub pod time code
1             package DBIx::Class::KiokuDB::EntryProxy;
2             BEGIN {
3 5     5   193 $DBIx::Class::KiokuDB::EntryProxy::AUTHORITY = 'cpan:NUFFIN';
4             }
5             # ABSTRACT: A proxying result class for KiokuDB objects
6             $DBIx::Class::KiokuDB::EntryProxy::VERSION = '1.23';
7 5     5   30 use strict;
  5         12  
  5         106  
8 5     5   28 use warnings;
  5         19  
  5         130  
9              
10 5     5   49 use namespace::clean;
  5         10  
  5         50  
11              
12 5     5   1236 use base qw(DBIx::Class);
  5         14  
  5         1171  
13              
14             sub inflate_result {
15 1     1 0 4559 my ( $self, $source, $data ) = @_;
16              
17 1         5 my $handle = $source->schema->kiokudb_handle;
18              
19 1 50       8 if ( ref( my $obj = $handle->id_to_object( $data->{id} ) ) ) {
20 0         0 return $obj;
21             } else {
22 1         154 my $entry = $handle->backend->deserialize($data->{data});
23 1         456 return $handle->linker->expand_object($entry);
24             }
25             }
26              
27             sub new {
28 0     0 0   croak("Creating new rows via the result set makes no sense, insert them with KiokuDB::insert instead");
29             }
30              
31             # ex: set sw=4 et:
32              
33             __PACKAGE__
34              
35             __END__
36              
37             =pod
38              
39             =encoding UTF-8
40              
41             =head1 NAME
42              
43             DBIx::Class::KiokuDB::EntryProxy - A proxying result class for KiokuDB objects
44              
45             =head1 VERSION
46              
47             version 1.23
48              
49             =head1 SYNOPSIS
50              
51             my $kiokudb_object = $schema->resultset("entries")->find($id);
52              
53             =head1 DESCRIPTION
54              
55             This class implements the necessary glue to properly inflate resultsets for
56             L<KiokuDB> object into proper instances using L<KiokuDB>.
57              
58             =for Pod::Coverage new
59             inflate_result
60              
61             =head1 AUTHOR
62              
63             Yuval Kogman <nothingmuch@woobling.org>
64              
65             =head1 COPYRIGHT AND LICENSE
66              
67             This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.
68              
69             This is free software; you can redistribute it and/or modify it under
70             the same terms as the Perl 5 programming language system itself.
71              
72             =cut