querycounter role, test for that and a new schema hierarchy for additional Moose...
[dbsrgits/DBIx-Class.git] / t / lib / DBICNGTest / Schema / ResultSet / Person.pm
1 package # hide from pause
2  DBICNGTest::Schema::ResultSet::Person;
3
4         use Moose;
5         extends 'DBICNGTest::Schema::ResultSet';
6
7
8 =head1 NAME
9
10 DBICNGTest::Schema::ResultSet:Person; Example Resultset
11
12 =head1 VERSION
13
14 0.01
15
16 =cut
17
18 our $VERSION = '0.01';
19
20
21 =head1 SYNOPSIS
22
23     ##Example Usage
24
25 See Tests for more example usage.
26
27 =head1 DESCRIPTION
28
29 Resultset Methods for the Person Source
30
31 =head1 ATTRIBUTES
32
33 This class defines the following attributes.
34
35 =head2 literal
36
37 a literal attribute for testing
38
39 =cut
40
41 has 'literal' => (is=>'ro', isa=>'Str', required=>1, lazy=>1, default=>'hi');
42
43
44 =head2 available_genders
45
46 A resultset of the genders people can have.  Keep in mind this get's run once
47 only at the first compile, so it's only good for stuff that doesn't change
48 between reboots.
49
50 =cut
51
52 has 'available_genders' => (
53     is=>'ro',
54     isa=>'DBICNGTest::Schema::ResultSet',
55     required=>1,
56     lazy=>1,
57     default=> sub {
58         shift
59             ->result_source
60             ->schema
61             ->resultset('Gender');
62     }
63 );
64
65
66 =head1 METHODS
67
68 This module defines the following methods.
69
70 =head2 older_than($int)
71
72 Only people over a given age
73
74 =cut
75
76 sub older_than
77 {
78     my ($self, $age) = @_;
79     
80     return $self->search({age=>{'>'=>$age}});
81 }
82
83
84 =head1 AUTHORS
85
86 See L<DBIx::Class> for more information regarding authors.
87
88 =head1 LICENSE
89
90 You may distribute this code under the same terms as Perl itself.
91
92 =cut
93
94
95 1;