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 { $_ !~ /^#/ } @_; |
55e2d745 |
14 | $class->_load_components(@comp); |
15 | } |
16 | |
17 | sub load_own_components { |
18 | my $class = shift; |
19 | my @comp = map { "${class}::$_" } grep { $_ !~ /^#/ } @_; |
20 | $class->_load_components(@comp); |
21 | } |
22 | |
23 | sub _load_components { |
24 | my ($class, @comp) = @_; |
126042ee |
25 | foreach my $comp (@comp) { |
26 | eval "use $comp"; |
27 | die $@ if $@; |
28 | } |
29 | no strict 'refs'; |
30 | unshift(@{"${class}::ISA"}, @comp); |
31 | } |
32 | |
ea2e61bf |
33 | 1; |
34d52be2 |
34 | |
35 | =head1 NAME |
36 | |
37 | DBIx::Class - Because the brain is a terrible thing to waste. |
38 | |
39 | =head1 SYNOPSIS |
40 | |
41 | =head1 DESCRIPTION |
42 | |
43 | This is a sql to oop mapper, inspired by the L<Class::DBI> framework, |
44 | and meant to support compability with it, while restructuring the |
45 | insides, and making it possible to support some new features like |
46 | self-joins, distinct, group bys and more. |
47 | |
daec44b8 |
48 | It's currently considered EXPERIMENTAL - bring this near a production |
49 | database at your own risk! The API is *not* fixed yet, although most of |
50 | the primitives should be good for the future and any API changes will be |
51 | posted to the mailing list before they're committed. |
52 | |
53 | The community can be found via - |
54 | |
55 | Mailing list: http://lists.rawmode.org/mailman/listinfo/dbix-class/ |
56 | |
57 | SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ |
58 | |
59 | Wiki: http://dbix-class.shadowcatsystems.co.uk/ |
60 | |
61 | IRC: irc.perl.org#dbix-class |
62 | |
39fe0e65 |
63 | =head1 QUICKSTART |
64 | |
65 | If you're using Class::DBI, replacing |
66 | |
daec44b8 |
67 | use base qw/Class::DBI/; |
39fe0e65 |
68 | |
69 | with |
70 | |
daec44b8 |
71 | use base qw/DBIx::Class/; |
72 | __PACKAGE__->load_components(qw/CDBICompat Core DB/); |
39fe0e65 |
73 | |
74 | will probably get you started. |
75 | |
76 | If you're using AUTO_INCREMENT for your primary columns, you'll also want |
126042ee |
77 | yo load the approriate PK::Auto subclass - e.g. |
78 | |
daec44b8 |
79 | __PACKAGE__->load_components(qw/CDBICompat PK::Auto::SQLite Core DB/); |
126042ee |
80 | |
81 | (with is what ::Test::SQLite does to present the Class::DBI::Test::SQLite |
82 | interface) |
39fe0e65 |
83 | |
84 | If you fancy playing around with DBIx::Class from scratch, then read the docs |
85 | for ::Table and ::Relationship, |
86 | |
daec44b8 |
87 | use base qw/DBIx::Class/; |
88 | __PACKAGE__->load_components(qw/Core DB/); |
39fe0e65 |
89 | |
90 | and have a look at t/lib/DBICTest.pm for a brief example. |
91 | |
34d52be2 |
92 | =head1 AUTHORS |
93 | |
daec44b8 |
94 | Matt S. Trout <mst@shadowcatsystems.co.uk> |
34d52be2 |
95 | |
96 | =head1 LICENSE |
97 | |
98 | You may distribute this code under the same terms as Perl itself. |
99 | |
100 | =cut |
101 | |