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