line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Aniki::Result; |
2
|
27
|
|
|
27
|
|
10326
|
use 5.014002; |
|
27
|
|
|
|
|
89
|
|
3
|
|
|
|
|
|
|
|
4
|
27
|
|
|
27
|
|
149
|
use namespace::autoclean; |
|
27
|
|
|
|
|
55
|
|
|
27
|
|
|
|
|
164
|
|
5
|
27
|
|
|
27
|
|
1815
|
use Mouse v2.4.5; |
|
27
|
|
|
|
|
292
|
|
|
27
|
|
|
|
|
145
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has table_name => ( |
8
|
|
|
|
|
|
|
is => 'ro', |
9
|
|
|
|
|
|
|
required => 1, |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has suppress_row_objects => ( |
13
|
|
|
|
|
|
|
is => 'rw', |
14
|
|
|
|
|
|
|
lazy => 1, |
15
|
|
|
|
|
|
|
default => sub { shift->handler->suppress_row_objects }, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has row_class => ( |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
lazy => 1, |
21
|
|
|
|
|
|
|
default => sub { |
22
|
|
|
|
|
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
$self->handler->guess_row_class($self->table_name); |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my %handler; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub BUILD { |
30
|
90
|
|
|
90
|
1
|
1618
|
my ($self, $args) = @_; |
31
|
90
|
|
|
|
|
1415
|
$handler{0+$self} = delete $args->{handler}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
157
|
|
|
157
|
1
|
757
|
sub handler { $handler{0+shift} } |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub DEMOLISH { |
37
|
90
|
|
|
90
|
1
|
29843
|
my $self = shift; |
38
|
90
|
|
|
|
|
1580
|
delete $handler{0+$self}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
42
|
|
|
|
|
|
|
__END__ |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=encoding utf-8 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Aniki::Result - Result class |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $result = $db->select(foo => { bar => 1 }); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This is abstract result class. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Aniki detect the collection class from root result class by table name. |
61
|
|
|
|
|
|
|
Default root result class is C<MyApp::DB::Collection>. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
You can use original result class: |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
package MyApp::DB; |
66
|
|
|
|
|
|
|
use Mouse; |
67
|
|
|
|
|
|
|
extends qw/Aniki/; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__PACKAGE__->setup( |
70
|
|
|
|
|
|
|
schema => 'MyApp::DB::Schema', |
71
|
|
|
|
|
|
|
result => 'MyApp::DB::Collection', |
72
|
|
|
|
|
|
|
); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 ACCESSORS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=over 4 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item C<handler : Aniki> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item C<table_name : Str> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item C<suppress_row_objects : Bool> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item C<row_class : ClassName> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 LICENSE |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Copyright (C) karupanerura. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
93
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 AUTHOR |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
karupanerura E<lt>karupa@cpan.orgE<gt> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |