Commit | Line | Data |
ea2e61bf |
1 | package DBIx::Class; |
2 | |
5d283305 |
3 | use strict; |
4 | use warnings; |
5 | |
5d283305 |
6 | use vars qw($VERSION); |
126042ee |
7 | use base; |
5d283305 |
8 | |
9 | $VERSION = '0.01'; |
10 | |
126042ee |
11 | sub 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 |
22 | 1; |
34d52be2 |
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 | |
39fe0e65 |
37 | =head1 QUICKSTART |
38 | |
39 | If you're using Class::DBI, replacing |
40 | |
41 | use base qw/Class::DBI/; |
42 | |
43 | with |
44 | |
126042ee |
45 | use base qw/DBIx::Class/; |
46 | __PACKAGE__->load_components(qw/CDBICompat Core/); |
39fe0e65 |
47 | |
48 | will probably get you started. |
49 | |
50 | If you're using AUTO_INCREMENT for your primary columns, you'll also want |
126042ee |
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) |
39fe0e65 |
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/; |
126042ee |
62 | __PACKAGE__->load_components(qw/Core/); |
39fe0e65 |
63 | |
64 | and have a look at t/lib/DBICTest.pm for a brief example. |
65 | |
34d52be2 |
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 | |