File Coverage

blib/lib/KiokuDB/TypeMap/Entry/DBIC/ResultSet.pm
Criterion Covered Total %
statement 21 21 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 0 1 0.0
total 28 29 96.5


line stmt bran cond sub pod time code
1             package KiokuDB::TypeMap::Entry::DBIC::ResultSet;
2             BEGIN {
3 5     5   198 $KiokuDB::TypeMap::Entry::DBIC::ResultSet::AUTHORITY = 'cpan:NUFFIN';
4             }
5             $KiokuDB::TypeMap::Entry::DBIC::ResultSet::VERSION = '1.23';
6 5     5   34 use Moose;
  5         25  
  5         37  
7             # ABSTRACT: KiokuDB::TypeMap::Entry for DBIx::Class::ResultSet objects
8              
9 5     5   32275 use JSON;
  5         12  
  5         42  
10 5     5   662 use Scalar::Util qw(weaken);
  5         9  
  5         295  
11              
12 5     5   33 use namespace::autoclean;
  5         11  
  5         47  
13              
14             extends qw(KiokuDB::TypeMap::Entry::Naive);
15              
16             sub compile_collapse_body {
17 1     1 0 2553 my ( $self, @args ) = @_;
18              
19 1         7 my $sub = $self->SUPER::compile_collapse_body(@args);
20              
21             return sub {
22 1     1   1568 my ( $self, %args ) = @_;
23              
24 1         3 my $rs = $args{object};
25              
26 1         5 my $clone = $rs->search_rs;
27              
28             # clear all cached data
29 1         225 $clone->set_cache;
30              
31 1         16 $self->$sub( %args, object => $clone );
32 1         110 };
33             }
34              
35             __PACKAGE__->meta->make_immutable;
36              
37             # ex: set sw=4 et:
38              
39             __PACKAGE__
40              
41             __END__
42              
43             =pod
44              
45             =encoding UTF-8
46              
47             =head1 NAME
48              
49             KiokuDB::TypeMap::Entry::DBIC::ResultSet - KiokuDB::TypeMap::Entry for DBIx::Class::ResultSet objects
50              
51             =head1 VERSION
52              
53             version 1.23
54              
55             =head1 DESCRIPTION
56              
57             The result set is cloned, the clone will have its cache cleared, and then it is
58             simply serialized normally. This is the only L<DBIx::Class> related object that
59             is literally stored in the database, as it represents a memory resident object,
60             not a database resident one.
61              
62             =for Pod::Coverage compile_collapse_body
63              
64             =head1 AUTHOR
65              
66             Yuval Kogman <nothingmuch@woobling.org>
67              
68             =head1 COPYRIGHT AND LICENSE
69              
70             This software is copyright (c) 2014 by Yuval Kogman, Infinity Interactive.
71              
72             This is free software; you can redistribute it and/or modify it under
73             the same terms as the Perl 5 programming language system itself.
74              
75             =cut