| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Aniki::Result; | 
| 2 | 27 |  |  | 27 |  | 12312 | use 5.014002; | 
|  | 27 |  |  |  |  | 101 |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 | 27 |  |  | 27 |  | 156 | use namespace::autoclean; | 
|  | 27 |  |  |  |  | 59 |  | 
|  | 27 |  |  |  |  | 175 |  | 
| 5 | 27 |  |  | 27 |  | 2193 | use Mouse v2.4.5; | 
|  | 27 |  |  |  |  | 344 |  | 
|  | 27 |  |  |  |  | 195 |  | 
| 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 | 85 |  |  | 85 | 1 | 2315 | my ($self, $args) = @_; | 
| 31 | 85 |  |  |  |  | 1568 | $handler{0+$self} = delete $args->{handler}; | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 | 151 |  |  | 151 | 1 | 843 | sub handler { $handler{0+shift} } | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | sub DEMOLISH { | 
| 37 | 85 |  |  | 85 | 1 | 36088 | my $self = shift; | 
| 38 | 85 |  |  |  |  | 1709 | 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 |