Mostly refactored everything to select/update/delete off storage handle
[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;
8
9 $VERSION = '0.01';
10
11 sub load_components {
12   my $class = shift;
13   my @comp = map { "DBIx::Class::$_" } grep { $_ !~ /^#/ } @_;
14   foreach my $comp (@comp) {
15     eval "use $comp";
16     die $@ if $@;
17   }
18   no strict 'refs';
19   unshift(@{"${class}::ISA"}, @comp);
20 }
21
22 1;
23
24 =head1 NAME 
25
26 DBIx::Class - Because the brain is a terrible thing to waste.
27
28 =head1 SYNOPSIS
29
30 =head1 DESCRIPTION
31
32 This is a sql to oop mapper, inspired by the L<Class::DBI> framework, 
33 and meant to support compability with it, while restructuring the 
34 insides, and making it possible to support some new features like 
35 self-joins, distinct, group bys and more.
36
37 =head1 QUICKSTART
38
39 If you're using Class::DBI, replacing
40
41 use base qw/Class::DBI/;
42
43 with
44
45 use base qw/DBIx::Class/;
46 __PACKAGE__->load_components(qw/CDBICompat Core/);
47
48 will probably get you started.
49
50 If you're using AUTO_INCREMENT for your primary columns, you'll also want
51 yo load the approriate PK::Auto subclass - e.g.
52
53 __PACKAGE__->load_components(qw/CDBICompat PK::Auto::SQLite Core/);
54
55 (with is what ::Test::SQLite does to present the Class::DBI::Test::SQLite
56 interface)
57
58 If you fancy playing around with DBIx::Class from scratch, then read the docs
59 for ::Table and ::Relationship,
60
61 use base qw/DBIx::Class/;
62 __PACKAGE__->load_components(qw/Core/);
63
64 and have a look at t/lib/DBICTest.pm for a brief example.
65
66 =head1 AUTHORS
67
68 Matt S. Trout <perl-stuff@trout.me.uk>
69
70 =head1 LICENSE
71
72 You may distribute this code under the same terms as Perl itself.
73
74 =cut
75