Merged patched from andyg to throw useful errors during relationship loading
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Relationship / Base.pm
index 5b654af..4590985 100644 (file)
@@ -3,7 +3,7 @@ package DBIx::Class::Relationship::Base;
 use strict;
 use warnings;
 
-use base qw/Class::Data::Inheritable/;
+use base qw/DBIx::Class/;
 
 __PACKAGE__->mk_classdata('_relationships', { } );
 
@@ -43,6 +43,9 @@ sub add_relationship {
   die "Can't create relationship without join condition" unless $cond;
   $attrs ||= {};
   eval "require $f_class;";
+  if ($@) {
+    $class->throw($@) unless $@ =~ /Can't locate/;
+  }
   my %rels = %{ $class->_relationships };
   $rels{$rel} = { class => $f_class,
                   cond  => $cond,
@@ -123,7 +126,7 @@ sub _cond_key {
             join(', ', keys %{$attrs->{_aliases} || {}}) );
     }
   }
-  return $self->NEXT::ACTUAL::_cond_key($attrs, $key);
+  return $self->next::method($attrs, $key);
 }
 
 sub _cond_value {
@@ -151,7 +154,7 @@ sub _cond_value {
     }
   }
       
-  return $self->NEXT::ACTUAL::_cond_value($attrs, $key, $value)
+  return $self->next::method($attrs, $key, $value)
 }
 
 =item search_related