trivial optimization to MODIFY_CODE_ATTRIBUTES
[dbsrgits/DBIx-Class-Historic.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
128Andy Grundman <andy@hybridized.org>
129
130Brian Cassidy <bricas@cpan.org>
131
132Dan Kubb <dan.kubb-cpan@onautopilot.com>
133
134Dan Sully <daniel@cpan.org>
135
ccb9c9b1 136David Kamholz <dkamholz@cpan.org>
137
138Jules Bean
3942ab4d 139
140Marcus Ramberg <mramberg@cpan.org>
141
ccb9c9b1 142Paul Makepeace
143
4685e006 144CL Kao
145
146Jess Robinson
147
148Marcus Ramberg
149
8fe164b9 150Will Hawes
151
ad3d2d7c 152Todd Lipcon
153
5fb0c64c 154Daniel Westermann-Clark <danieltwc@cpan.org>
155
d7c4c15c 156Alexander Hartmaier <alex_hartmaier@hotmail.com>
157
103e3e03 158Zbigniew Lukasiak
159
6565b410 160Nigel Metheringham <nigelm@cpan.org>
161
7be93b07 162Jesper Krogh
163
412db1f4 164Brandon Black
165
4763f4b7 166Christopher H. Laco
167
a53b95f1 168Scotty Allen <scotty@scottyallen.com>
169
022e0893 170sc_
171
ba606e58 172Robert Sedlacek <phaylon@dunkelheit.at
173
d8627bf1 174Justin Guenther <guentherj@agr.gc.ca>
181a28f4 175
e063fe2c 176Daisuke Murase <typester@cpan.org>
177
c0e7b4e5 178Scott McWhirter (konobi)
179
34d52be2 180=head1 LICENSE
181
182You may distribute this code under the same terms as Perl itself.
183
184=cut
185