Merge 'trunk' into 'cdbicompat_integration'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat.pm
1 package DBIx::Class::CDBICompat;
2
3 use strict;
4 use warnings;
5 use base qw/DBIx::Class::Core DBIx::Class::DB/;
6 use Carp::Clan qw/^DBIx::Class/;
7
8 eval {
9   require Class::Trigger;
10   require DBIx::ContextualFetch;
11 };
12 croak "Class::Trigger and DBIx::ContextualFetch is required for CDBICompat" if $@;
13
14 __PACKAGE__->load_own_components(qw/
15   Constraints
16   Triggers
17   ReadOnly
18   LiveObjectIndex
19   AttributeAPI
20   Stringify
21   DestroyWarning
22   Constructor
23   AccessorMapping
24   ColumnCase
25   HasA
26   HasMany
27   MightHave
28   Copy
29   LazyLoading
30   AutoUpdate
31   TempColumns
32   GetSet
33   Retrieve
34   Pager
35   ColumnGroups
36   AbstractSearch
37   ImaDBI
38   Iterator
39 /);
40
41             #DBIx::Class::ObjIndexStubs
42 1;
43
44 =head1 NAME
45
46 DBIx::Class::CDBICompat - Class::DBI Compatibility layer.
47
48 =head1 SYNOPSIS
49
50   use base qw/DBIx::Class/;
51   __PACKAGE__->load_components(qw/CDBICompat Core DB/);
52
53 =head1 DESCRIPTION
54
55 DBIx::Class features a fully featured compatibility layer with L<Class::DBI>
56 and L<Class::DBI::AbstractSearch> to ease transition for existing CDBI users. 
57
58 In fact, this class is just a receipe containing all the features emulated.
59 If you like, you can choose which features to emulate by building your 
60 own class and loading it like this:
61
62   __PACKAGE__->load_own_components(qw/CDBICompat/);
63
64 this will automatically load the features included in My::DB::CDBICompat,
65 provided it looks something like this:
66
67   package My::DB::CDBICompat;
68   __PACKAGE__->load_components(qw/
69     CDBICompat::ColumnGroups
70     CDBICompat::Retrieve
71     CDBICompat::HasA
72     CDBICompat::HasMany
73     CDBICompat::MightHave
74   /);
75
76 =head1 COMPONENTS
77
78 =over 4
79
80 =item AccessorMapping
81
82 =item AbstractSearch
83
84 Compatibility with Class::DBI::AbstractSearch.
85
86 =item AttributeAPI
87
88 =item AutoUpdate
89
90 Allows you to turn on automatic updates for column values.
91
92 =item ColumnCase
93
94 =item ColumnGroups
95
96 =item Constraints
97
98 =item Constructor
99
100 =item DestroyWarning
101
102 =item GetSet
103
104 =item HasA
105
106 =item HasMany
107
108 =item ImaDBI
109
110 =item LazyLoading
111
112 =item LiveObjectIndex
113
114 The live object index tries to ensure there is only one version of a object
115 in the perl interpreter.
116
117 =item MightHave
118
119 =item ObjIndexStubs
120
121 =item ReadOnly
122
123 =item Retrieve
124
125 =item Stringify
126
127 =item TempColumns
128
129 =item Triggers
130
131 =item PassThrough
132
133 =back
134
135 =head1 LIMITATIONS
136
137 The following methods and classes are not emulated, maybe in the future.
138
139 =over 4
140
141 =item Class::DBI::Query
142
143 Deprecated in Class::DBI.
144
145 =item Class::DBI::Column
146
147 Not documented in Class::DBI.  CDBICompat's columns() returns a plain string, not an object.
148
149 =item data_type()
150
151 Undocumented CDBI method.
152
153 =item meta_info()
154
155 Undocumented CDBI method.
156
157 =back
158
159 =head1 AUTHORS
160
161 Matt S. Trout <mst@shadowcatsystems.co.uk>
162
163 =head1 LICENSE
164
165 You may distribute this code under the same terms as Perl itself.
166
167 =cut
168