File Coverage

blib/lib/DBIx/MoCo/Join.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 3 4 75.0
total 23 24 95.8


line stmt bran cond sub pod time code
1             package DBIx::MoCo::Join;
2 1     1   51848 use strict;
  1         4  
  1         36  
3 1     1   5 use Carp;
  1         2  
  1         81  
4 1     1   6 use base qw(DBIx::MoCo::Readonly);
  1         1  
  1         456  
5              
6 2     2 1 471 sub primary_keys {[]}
7 1     1 1 5 sub unique_keys {[]}
8 1     1 0 5 sub cache {}
9 2     2 1 13 sub columns {}
10              
11             1;
12              
13             =head1 NAME
14              
15             DBIx::MoCo::Join - Base class for joined DBIx::MoCo classes.
16              
17             =head1 SYNOPSIS
18              
19             package Blog::BookmarkEntry;
20             use base qw(DBIx::MoCo::Join Blog::Bookmark Blog::Entry);
21              
22             __PACKAGE__->table('bookmark inner join entry using(entry_id)');
23             __PACKAGE__->has_a(
24             entry => 'Blog::Entry',
25             { key => 'entry_id' },
26             );
27              
28             1;
29              
30             Then you can use this class for search etc...
31              
32             my $bookmarks = Blog::BookmarkEntry->search(
33             where => ['uri = ?', $uri], # search by entry's field
34             );
35             print $bookmarks->first->title; # able to use Blog::Entry's method
36              
37             =head1 SEE ALSO
38              
39             L
40              
41             =head1 AUTHOR
42              
43             Junya Kondo, Ejkondo@hatena.comE
44              
45             =head1 COPYRIGHT AND LICENSE
46              
47             Copyright (C) Hatena Inc. All Rights Reserved.
48              
49             This library is free software; you may redistribute it and/or modify
50             it under the same terms as Perl itself.
51              
52             =cut