- move attribute recording to DBIx::Class
[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.05000';
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     my $cache = $class->_attr_cache;
25     $class->_attr_cache->{$code} = [@attrs];
26     return ();
27 }
28
29 1;
30
31 =head1 NAME 
32
33 DBIx::Class - Extensible and flexible object <-> relational mapper.
34
35 =head1 SYNOPSIS
36
37 =head1 DESCRIPTION
38
39 This is an SQL to OO mapper, inspired by the L<Class::DBI> framework, 
40 and meant to support compability with it, while restructuring the 
41 internals and making it possible to support some new features like 
42 self-joins, distinct, group bys and more.
43
44 This project is still at an early stage, so the maintainers don't make
45 any absolute promise that full backwards-compatibility will be supported;
46 however, if we can without compromising the improvements we're trying to
47 make, we will, and any non-compatible changes will merit a full justification
48 on the mailing list and a CPAN developer release for people to test against.
49
50 The community can be found via -
51
52   Mailing list: http://lists.rawmode.org/mailman/listinfo/dbix-class/
53
54   SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
55
56   Wiki: http://dbix-class.shadowcatsystems.co.uk/
57
58   IRC: irc.perl.org#dbix-class
59
60 =head1 QUICKSTART
61
62 If you're using L<Class::DBI>, and want an easy and fast way of migrating to
63 DBIx::Class, take a look at L<DBIx::Class::CDBICompat>.
64
65 There are two ways of using DBIx::Class, the "simple" way and the "schema" way.
66 The "simple" way of using DBIx::Class needs less classes than the "schema"
67 way but doesn't give you the ability to easily use different database connections.
68
69 Some examples where different database connections are useful are:
70
71 different users with different rights
72 different databases with the same schema.
73
74 =head2 Simple
75
76 First you need to create a base class which all other classes will inherit from.
77 See L<DBIx::Class::DB> for information on how to do this.
78
79 Then you need to create a class for every table you want to use with DBIx::Class.
80 See L<DBIx::Class::Table> for information on how to do this.
81
82 =head2 Schema
83
84 With this approach, the table classes inherit directly from DBIx::Class::Core,
85 although it might be a good idea to create a "parent" class for all table
86 classes that inherits from DBIx::Class::Core and adds additional methods
87 needed by all table classes, e.g. reading a config file or loading auto primary
88 key support.
89
90 Look at L<DBIx::Class::Schema> for information on how to do this.
91
92 If you need more help, check out the introduction in the 
93 manual below.
94
95 =head1 SEE ALSO
96
97 =head2 L<DBIx::Class::Core> - DBIC Core Classes
98
99 =head2 L<DBIx::Class::Manual> - User's manual
100
101 =head2 L<DBIx::Class::CDBICompat> - L<Class::DBI> Compat layer
102
103 =head2 L<DBIx::Class::DB> - database-level methods
104
105 =head2 L<DBIx::Class::Table> - table-level methods
106
107 =head2 L<DBIx::Class::Row> - row-level methods
108
109 =head2 L<DBIx::Class::PK> - primary key methods
110
111 =head2 L<DBIx::Class::ResultSet> - search result-set methods
112
113 =head2 L<DBIx::Class::Relationship> - relationships between tables
114
115 =head1 AUTHOR
116
117 Matt S. Trout <mst@shadowcatsystems.co.uk>
118
119 =head1 CONTRIBUTORS
120
121 Andy Grundman <andy@hybridized.org>
122
123 Brian Cassidy <bricas@cpan.org>
124
125 Dan Kubb <dan.kubb-cpan@onautopilot.com>
126
127 Dan Sully <daniel@cpan.org>
128
129 David Kamholz <dkamholz@cpan.org>
130
131 Jules Bean
132
133 Marcus Ramberg <mramberg@cpan.org>
134
135 Paul Makepeace
136
137 CL Kao
138
139 Jess Robinson
140
141 Marcus Ramberg
142
143 Will Hawes
144
145 Todd Lipcon
146
147 Daniel Westermann-Clark <danieltwc@cpan.org>
148
149 Alexander Hartmaier <alex_hartmaier@hotmail.com>
150
151 Zbigniew Lukasiak
152
153 Nigel Metheringham <nigelm@cpan.org>
154
155 Jesper Krogh
156
157 Brandon Black
158
159 =head1 LICENSE
160
161 You may distribute this code under the same terms as Perl itself.
162
163 =cut
164