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