X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass.pm;h=855f0b496e14a14a25e52e6161089fbdd13bd14a;hb=d0bb3812791971bbc5f40490d704b511a5f1b00d;hp=c1cc569de850e950c95ed2d4ae451ccebc196bec;hpb=126042ee4b9394c4eecc6ece49469da6fce23ba3;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index c1cc569..855f0b4 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -4,68 +4,163 @@ use strict; use warnings; use vars qw($VERSION); -use base; - -$VERSION = '0.01'; - -sub load_components { - my $class = shift; - my @comp = map { "DBIx::Class::$_" } @_; - foreach my $comp (@comp) { - eval "use $comp"; - die $@ if $@; - } - no strict 'refs'; - unshift(@{"${class}::ISA"}, @comp); +use base qw/DBIx::Class::Componentised Class::Data::Accessor/; + +sub mk_classdata { shift->mk_classaccessor(@_); } +sub component_base_class { 'DBIx::Class' } + +# Always remember to do all digits for the version even if they're 0 +# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports +# brain damage and presumably various other packaging systems too + +$VERSION = '0.05005'; + +sub MODIFY_CODE_ATTRIBUTES { + my ($class,$code,@attrs) = @_; + unless ($class->can('_attr_cache')) { + $class->mk_classdata('_attr_cache'); + $class->_attr_cache({}); + } + my $cache = $class->_attr_cache; + $class->_attr_cache->{$code} = [@attrs]; + return (); } 1; =head1 NAME -DBIx::Class - Because the brain is a terrible thing to waste. +DBIx::Class - Extensible and flexible object <-> relational mapper. =head1 SYNOPSIS =head1 DESCRIPTION -This is a sql to oop mapper, inspired by the L framework, +This is an SQL to OO mapper, inspired by the L framework, and meant to support compability with it, while restructuring the -insides, and making it possible to support some new features like +internals and making it possible to support some new features like self-joins, distinct, group bys and more. +This project is still at an early stage, so the maintainers don't make +any absolute promise that full backwards-compatibility will be supported; +however, if we can without compromising the improvements we're trying to +make, we will, and any non-compatible changes will merit a full justification +on the mailing list and a CPAN developer release for people to test against. + +The community can be found via - + + Mailing list: http://lists.rawmode.org/mailman/listinfo/dbix-class/ + + SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/ + + Wiki: http://dbix-class.shadowcatsystems.co.uk/ + + IRC: irc.perl.org#dbix-class + =head1 QUICKSTART -If you're using Class::DBI, replacing +If you're using L, and want an easy and fast way of migrating to +DBIx::Class, take a look at L. + +There are two ways of using DBIx::Class, the "simple" way and the "schema" way. +The "simple" way of using DBIx::Class needs less classes than the "schema" +way but doesn't give you the ability to easily use different database connections. + +Some examples where different database connections are useful are: + +different users with different rights +different databases with the same schema. + +=head2 Simple + +First you need to create a base class which all other classes will inherit from. +See L for information on how to do this. + +Then you need to create a class for every table you want to use with DBIx::Class. +See L for information on how to do this. + +=head2 Schema + +With this approach, the table classes inherit directly from DBIx::Class::Core, +although it might be a good idea to create a "parent" class for all table +classes that inherits from DBIx::Class::Core and adds additional methods +needed by all table classes, e.g. reading a config file or loading auto primary +key support. + +Look at L for information on how to do this. + +If you need more help, check out the introduction in the +manual below. + +=head1 SEE ALSO + +=over 4 + +=item L - DBIC Core Classes + +=item L - User's manual + +=item L - L Compat layer + +=item L + +=item L + +=item L + +=item L - row-level methods + +=item L - primary key methods + +=item L - relationships between tables + +=back + +=head1 AUTHOR + +Matt S. Trout + +=head1 CONTRIBUTORS + +Andy Grundman + +Brian Cassidy + +Dan Kubb + +Dan Sully + +David Kamholz + +Jules Bean + +Marcus Ramberg + +Paul Makepeace -use base qw/Class::DBI/; +CL Kao -with +Jess Robinson -use base qw/DBIx::Class/; -__PACKAGE__->load_components(qw/CDBICompat Core/); +Marcus Ramberg -will probably get you started. +Will Hawes -If you're using AUTO_INCREMENT for your primary columns, you'll also want -yo load the approriate PK::Auto subclass - e.g. +Todd Lipcon -__PACKAGE__->load_components(qw/CDBICompat PK::Auto::SQLite Core/); +Daniel Westermann-Clark -(with is what ::Test::SQLite does to present the Class::DBI::Test::SQLite -interface) +Alexander Hartmaier -If you fancy playing around with DBIx::Class from scratch, then read the docs -for ::Table and ::Relationship, +Zbigniew Lukasiak -use base qw/DBIx::Class/; -__PACKAGE__->load_components(qw/Core/); +Nigel Metheringham -and have a look at t/lib/DBICTest.pm for a brief example. +Jesper Krogh -=head1 AUTHORS +Brandon Black -Matt S. Trout +Scotty Allen =head1 LICENSE