add Changes and CONTRIBUTORS entries
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader.pm
index 43b08e9..6d9c568 100644 (file)
@@ -10,7 +10,7 @@ use Scalar::Util qw/ weaken /;
 # 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
-our $VERSION = '0.04999_14';
+our $VERSION = '0.05001';
 
 __PACKAGE__->mk_group_accessors('inherited', qw/
                                 _loader_args
@@ -76,11 +76,12 @@ DBIx::Class::Schema::Loader automates the definition of a
 L<DBIx::Class::Schema> by scanning database table definitions and
 setting up the columns, primary keys, and relationships.
 
-DBIx::Class::Schema::Loader currently supports only the DBI storage type.
-It has explicit support for L<DBD::Pg>, L<DBD::mysql>, L<DBD::DB2>,
-L<DBD::SQLite>, and L<DBD::Oracle>.  Other DBI drivers may function to
-a greater or lesser degree with this loader, depending on how much of the
-DBI spec they implement, and how standard their implementation is.
+DBIx::Class::Schema::Loader currently supports only the DBI storage type.  It
+has explicit support for L<DBD::Pg>, L<DBD::mysql>, L<DBD::DB2>,
+L<DBD::SQLite>, L<DBD::Sybase> (for Sybase ASE and MSSSQL), L<DBD::ODBC> (for
+MSSQL) and L<DBD::Oracle>.  Other DBI drivers may function to a greater or
+lesser degree with this loader, depending on how much of the DBI spec they
+implement, and how standard their implementation is.
 
 Patches to make other DBDs work correctly welcome.
 
@@ -142,11 +143,45 @@ sub loader_options {
     my $self = shift;
 
     my %args = (ref $_[0] eq 'HASH') ? %{$_[0]} : @_;
+    $self->_validate_loader_options(\%args);
     $self->_loader_args(\%args);
 
     $self;
 }
 
+sub _validate_loader_options {
+    my $self = shift;
+    my $args = shift;
+    
+    my @class_keys = qw(
+        schema_base_class result_base_class additional_base_classes
+        left_base_classes additional_classes components resultset_components
+    );
+    foreach my $k ( grep { exists $args->{$_} } @class_keys ) {
+        my @classes = ref( $args->{$k} ) eq 'ARRAY' ? @{ $args->{$k} } : $args->{$k};
+        foreach my $c (@classes) {
+
+            # components default to being under the DBIx::Class namespace unless they
+            # are preceeded with a '+'
+            if ( $k =~ m/components$/ && $c !~ s/^\+// ) {
+                $c = 'DBIx::Class::' . $c;
+            }
+
+            # 1 == installed, 0 == not installed, undef == invalid classname
+            my $installed = Class::Inspector->installed($c);
+            if ( defined($installed) ) {
+                if ( $installed == 0 ) {
+                    croak qq/$c, as specified in the loader option "$k", is not installed/;
+                }
+            } else {
+                croak qq/$c, as specified in the loader option "$k", is an invalid class name/;
+            }
+        }
+    }
+
+    return;
+}
+
 sub _invoke_loader {
     my $self = shift;
     my $class = ref $self || $self;
@@ -462,7 +497,7 @@ blblack: Brandon Black <blblack@gmail.com>
 
 =head1 CONTRIBUTORS
 
-ilmarii: Dagfinn Ilmari MannsÃ¥ker <ilmari@ilmari.org>
+ilmari: Dagfinn Ilmari MannsE<aring>ker <ilmari@ilmari.org>
 
 arcanez: Justin Hunter <justin.d.hunter@gmail.com>
 
@@ -472,7 +507,7 @@ Caelum: Rafael Kitover <rkitover@cpan.org>
 
 TSUNODA Kazuya <drk@drk7.jp>
 
-Robert Bohne <rbo@openserv.org>
+rbo: Robert Bohne <rbo@cpan.org>
 
 ribasushi: Peter Rabbitson <ribasushi@cpan.org>
 
@@ -490,6 +525,10 @@ kane: Jos Boumans <kane@cpan.org>
 
 waawaamilk: Nigel McNie <nigel@mcnie.name>
 
+acmoore: Andrew Moore <amoore@cpan.org>
+
+bphillips: Brian Phillips <bphillips@cpan.org>
+
 ... and lots of other folks. If we forgot you, please write the current
 maintainer or RT.