13 my @comp = map { "DBIx::Class::$_" } grep { $_ !~ /^#/ } @_;
14 $class->_load_components(@comp);
17 sub load_own_components {
19 my @comp = map { "${class}::$_" } grep { $_ !~ /^#/ } @_;
20 $class->_load_components(@comp);
23 sub _load_components {
24 my ($class, @comp) = @_;
25 foreach my $comp (@comp) {
30 unshift(@{"${class}::ISA"}, @comp);
37 DBIx::Class - Because the brain is a terrible thing to waste.
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.
50 If you're using Class::DBI, replacing
52 use base qw/Class::DBI/;
56 use base qw/DBIx::Class/;
57 __PACKAGE__->load_components(qw/CDBICompat Core DB/);
59 will probably get you started.
61 If you're using AUTO_INCREMENT for your primary columns, you'll also want
62 yo load the approriate PK::Auto subclass - e.g.
64 __PACKAGE__->load_components(qw/CDBICompat PK::Auto::SQLite Core DB/);
66 (with is what ::Test::SQLite does to present the Class::DBI::Test::SQLite
69 If you fancy playing around with DBIx::Class from scratch, then read the docs
70 for ::Table and ::Relationship,
72 use base qw/DBIx::Class/;
73 __PACKAGE__->load_components(qw/Core DB/);
75 and have a look at t/lib/DBICTest.pm for a brief example.
79 Matt S. Trout <perl-stuff@trout.me.uk>
83 You may distribute this code under the same terms as Perl itself.