put phaylon back, he was a victim of svk :)
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class.pm
1 package DBIx::Class;
2
3 use strict;
4 use warnings;
5
6 use vars qw($VERSION);
7 use base qw/DBIx::Class::Componentised Class::Data::Accessor/;
8
9 sub mk_classdata { shift->mk_classaccessor(@_); }
10 sub component_base_class { 'DBIx::Class' }
11
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
16 $VERSION = '0.05999_04';
17
18 sub MODIFY_CODE_ATTRIBUTES {
19     my ($class,$code,@attrs) = @_;
20     unless ($class->can('__attr_cache')) {
21         $class->mk_classdata('__attr_cache');
22         $class->__attr_cache({});
23     }
24     $class->__attr_cache->{$code} = [@attrs];
25     return ();
26 }
27
28 sub _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
35 1;
36
37 =head1 NAME 
38
39 DBIx::Class - Extensible and flexible object <-> relational mapper.
40
41 =head1 SYNOPSIS
42
43 =head1 DESCRIPTION
44
45 This is an SQL to OO mapper, inspired by the L<Class::DBI> framework, 
46 and meant to support compability with it, while restructuring the 
47 internals and making it possible to support some new features like 
48 self-joins, distinct, group bys and more.
49
50 This project is still at an early stage, so the maintainers don't make
51 any absolute promise that full backwards-compatibility will be supported;
52 however, if we can without compromising the improvements we're trying to
53 make, we will, and any non-compatible changes will merit a full justification
54 on the mailing list and a CPAN developer release for people to test against.
55
56 The 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
66 =head1 QUICKSTART
67
68 If you're using L<Class::DBI>, and want an easy and fast way of migrating to
69 DBIx::Class, take a look at L<DBIx::Class::CDBICompat>.
70
71 There are two ways of using DBIx::Class, the "simple" way and the "schema" way.
72 The "simple" way of using DBIx::Class needs less classes than the "schema"
73 way but doesn't give you the ability to easily use different database connections.
74
75 Some examples where different database connections are useful are:
76
77 different users with different rights
78 different databases with the same schema.
79
80 =head2 Simple
81
82 First you need to create a base class which all other classes will inherit from.
83 See L<DBIx::Class::DB> for information on how to do this.
84
85 Then you need to create a class for every table you want to use with DBIx::Class.
86 See L<DBIx::Class::Table> for information on how to do this.
87
88 =head2 Schema
89
90 With this approach, the table classes inherit directly from DBIx::Class::Core,
91 although it might be a good idea to create a "parent" class for all table
92 classes that inherits from DBIx::Class::Core and adds additional methods
93 needed by all table classes, e.g. reading a config file or loading auto primary
94 key support.
95
96 Look at L<DBIx::Class::Schema> for information on how to do this.
97
98 If you need more help, check out the introduction in the 
99 manual below.
100
101 =head1 SEE ALSO
102
103 =over 4
104
105 =item L<DBIx::Class::Core> - DBIC Core Classes
106
107 =item L<DBIx::Class::Manual> - User's manual
108
109 =item L<DBIx::Class::CDBICompat> - L<Class::DBI> Compat layer
110
111 =item L<DBIx::Class::Schema>
112
113 =item L<DBIx::Class::ResultSet>
114
115 =item L<DBIx::Class::ResultSource>
116
117 =item L<DBIx::Class::Row> - row-level methods
118
119 =item L<DBIx::Class::PK> - primary key methods
120
121 =item L<DBIx::Class::Relationship> - relationships between tables
122
123 =back
124
125 =head1 AUTHOR
126
127 Matt S. Trout <mst@shadowcatsystems.co.uk>
128
129 =head1 CONTRIBUTORS
130
131 Andy Grundman <andy@hybridized.org>
132
133 Brian Cassidy <bricas@cpan.org>
134
135 Dan Kubb <dan.kubb-cpan@onautopilot.com>
136
137 Dan Sully <daniel@cpan.org>
138
139 David Kamholz <dkamholz@cpan.org>
140
141 Jules Bean
142
143 Marcus Ramberg <mramberg@cpan.org>
144
145 Paul Makepeace
146
147 CL Kao
148
149 Jess Robinson
150
151 Marcus Ramberg
152
153 Will Hawes
154
155 Todd Lipcon
156
157 Daniel Westermann-Clark <danieltwc@cpan.org>
158
159 Alexander Hartmaier <alex_hartmaier@hotmail.com>
160
161 Zbigniew Lukasiak
162
163 Nigel Metheringham <nigelm@cpan.org>
164
165 Jesper Krogh
166
167 Brandon Black
168
169 Christopher H. Laco
170
171 Scotty Allen <scotty@scottyallen.com>
172
173 sc_
174
175 Robert Sedlacek <phaylon@dunkelheit.at
176
177 Justin Guenther <guentherj@agr.gc.ca>
178
179 Daisuke Murase <typester@cpan.org>
180
181 Scott McWhirter (konobi)
182
183 =head1 LICENSE
184
185 You may distribute this code under the same terms as Perl itself.
186
187 =cut
188