Fixup for count
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class.pm
CommitLineData
ea2e61bf 1package DBIx::Class;
2
5d283305 3use strict;
4use warnings;
5
5d283305 6use vars qw($VERSION);
3c0068c1 7use base qw/DBIx::Class::Componentised Class::Data::Accessor/;
8
9sub mk_classdata { shift->mk_classaccessor(@_); }
7411204b 10sub component_base_class { 'DBIx::Class' }
227d4dee 11
95da6f35 12# Always remember to do all digits for the version even if they're 0
13# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
14# brain damage and presumably various other packaging systems too
15
1346e22d 16$VERSION = '0.05999_04';
b8777a0d 17
f0750722 18sub MODIFY_CODE_ATTRIBUTES {
19 my ($class,$code,@attrs) = @_;
a58cd74b 20 $class->mk_classdata('__attr_cache' => {}) unless $class->can('__attr_cache');
da95b45f 21 $class->__attr_cache->{$code} = [@attrs];
f0750722 22 return ();
23}
24
da95b45f 25sub _attr_cache {
26 my $self = shift;
27 my $cache = $self->can('__attr_cache') ? $self->__attr_cache : {};
28 my $rest = eval { $self->next::method };
29 return $@ ? $cache : { %$cache, %$rest };
30}
31
ea2e61bf 321;
34d52be2 33
34=head1 NAME
35
7e4b2f59 36DBIx::Class - Extensible and flexible object <-> relational mapper.
34d52be2 37
38=head1 SYNOPSIS
39
40=head1 DESCRIPTION
41
8091aa91 42This is an SQL to OO mapper, inspired by the L<Class::DBI> framework,
34d52be2 43and meant to support compability with it, while restructuring the
8091aa91 44internals and making it possible to support some new features like
34d52be2 45self-joins, distinct, group bys and more.
46
8091aa91 47This project is still at an early stage, so the maintainers don't make
96ce20f5 48any absolute promise that full backwards-compatibility will be supported;
8091aa91 49however, if we can without compromising the improvements we're trying to
96ce20f5 50make, we will, and any non-compatible changes will merit a full justification
51on the mailing list and a CPAN developer release for people to test against.
daec44b8 52
53The community can be found via -
54
55 Mailing list: http://lists.rawmode.org/mailman/listinfo/dbix-class/
56
57 SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
58
59 Wiki: http://dbix-class.shadowcatsystems.co.uk/
60
61 IRC: irc.perl.org#dbix-class
62
39fe0e65 63=head1 QUICKSTART
64
8091aa91 65If you're using L<Class::DBI>, and want an easy and fast way of migrating to
66DBIx::Class, take a look at L<DBIx::Class::CDBICompat>.
39fe0e65 67
8091aa91 68There are two ways of using DBIx::Class, the "simple" way and the "schema" way.
69The "simple" way of using DBIx::Class needs less classes than the "schema"
70way but doesn't give you the ability to easily use different database connections.
39fe0e65 71
448c8424 72Some examples where different database connections are useful are:
39fe0e65 73
448c8424 74different users with different rights
75different databases with the same schema.
39fe0e65 76
00787068 77=head2 Simple
126042ee 78
8091aa91 79First you need to create a base class which all other classes will inherit from.
80See L<DBIx::Class::DB> for information on how to do this.
39fe0e65 81
8091aa91 82Then you need to create a class for every table you want to use with DBIx::Class.
83See L<DBIx::Class::Table> for information on how to do this.
448c8424 84
85=head2 Schema
86
8091aa91 87With this approach, the table classes inherit directly from DBIx::Class::Core,
88although it might be a good idea to create a "parent" class for all table
89classes that inherits from DBIx::Class::Core and adds additional methods
90needed by all table classes, e.g. reading a config file or loading auto primary
448c8424 91key support.
92
8091aa91 93Look at L<DBIx::Class::Schema> for information on how to do this.
448c8424 94
8091aa91 95If you need more help, check out the introduction in the
448c8424 96manual below.
39fe0e65 97
076652e8 98=head1 SEE ALSO
99
a39e84a3 100=over 4
8091aa91 101
a39e84a3 102=item L<DBIx::Class::Core> - DBIC Core Classes
8091aa91 103
a39e84a3 104=item L<DBIx::Class::Manual> - User's manual
8091aa91 105
a39e84a3 106=item L<DBIx::Class::CDBICompat> - L<Class::DBI> Compat layer
076652e8 107
a39e84a3 108=item L<DBIx::Class::Schema>
076652e8 109
a39e84a3 110=item L<DBIx::Class::ResultSet>
076652e8 111
a39e84a3 112=item L<DBIx::Class::ResultSource>
076652e8 113
a39e84a3 114=item L<DBIx::Class::Row> - row-level methods
4db53147 115
a39e84a3 116=item L<DBIx::Class::PK> - primary key methods
117
118=item L<DBIx::Class::Relationship> - relationships between tables
119
120=back
076652e8 121
3942ab4d 122=head1 AUTHOR
34d52be2 123
daec44b8 124Matt S. Trout <mst@shadowcatsystems.co.uk>
34d52be2 125
3942ab4d 126=head1 CONTRIBUTORS
127
84e3c114 128Alexander Hartmaier <alex_hartmaier@hotmail.com>
129
3942ab4d 130Andy Grundman <andy@hybridized.org>
131
84e3c114 132Andres Kievsky
3942ab4d 133
84e3c114 134Brandon Black
3942ab4d 135
84e3c114 136Brian Cassidy <bricas@cpan.org>
3942ab4d 137
84e3c114 138Christopher H. Laco
ccb9c9b1 139
84e3c114 140CL Kao
3942ab4d 141
84e3c114 142Daisuke Murase <typester@cpan.org>
3942ab4d 143
84e3c114 144Dan Kubb <dan.kubb-cpan@onautopilot.com>
ccb9c9b1 145
84e3c114 146Dan Sully <daniel@cpan.org>
4685e006 147
84e3c114 148Daniel Westermann-Clark <danieltwc@cpan.org>
4685e006 149
84e3c114 150David Kamholz <dkamholz@cpan.org>
4685e006 151
84e3c114 152Jesper Krogh
8fe164b9 153
84e3c114 154Jess Robinson
ad3d2d7c 155
84e3c114 156Jules Bean
5fb0c64c 157
84e3c114 158Justin Guenther <guentherj@agr.gc.ca>
d7c4c15c 159
84e3c114 160Marcus Ramberg <mramberg@cpan.org>
103e3e03 161
6565b410 162Nigel Metheringham <nigelm@cpan.org>
163
84e3c114 164Paul Makepeace
4763f4b7 165
84e3c114 166Robert Sedlacek <phaylon@dunkelheit.at>
a53b95f1 167
84e3c114 168sc_ of irc.perl.org#dbix-class
022e0893 169
84e3c114 170Scott McWhirter (konobi)
ba606e58 171
84e3c114 172Scotty Allen <scotty@scottyallen.com>
181a28f4 173
84e3c114 174Todd Lipcon
e063fe2c 175
84e3c114 176Will Hawes
c0e7b4e5 177
34d52be2 178=head1 LICENSE
179
180You may distribute this code under the same terms as Perl itself.
181
182=cut
183