More indirect call removals: the second part of 77c3a5dc
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class.pm
index 33e84ce..f1c80ae 100644 (file)
@@ -18,8 +18,6 @@ $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev relea
 use DBIx::Class::_Util;
 use mro 'c3';
 
-use DBIx::Class::Optional::Dependencies;
-
 use base qw/DBIx::Class::Componentised DBIx::Class::AccessorGroup/;
 use DBIx::Class::StartupCheck;
 use DBIx::Class::Exception;
@@ -39,21 +37,23 @@ BEGIN {
   sub DESTROY { &DBIx::Class::_Util::detected_reinvoked_destructor };
 }
 
-sub mk_classdata {
-  shift->mk_classaccessor(@_);
-}
+sub component_base_class { 'DBIx::Class' }
 
-sub mk_classaccessor {
-  my $self = shift;
-  $self->mk_group_accessors('inherited', $_[0]);
-  $self->set_inherited(@_) if @_ > 1;
-}
+my $mro_already_set;
+sub inject_base {
 
-sub component_base_class { 'DBIx::Class' }
+  # only examine from $_[2] onwards
+  # C::C3::C already sets c3 on $_[1] and $_[0] is irrelevant
+  mro::set_mro( $_ => 'c3' ) for grep {
+    $mro_already_set->{$_} ? 0 : ( $mro_already_set->{$_} = 1 )
+  } @_[2 .. $#_];
+
+  shift->next::method(@_);
+}
 
 sub MODIFY_CODE_ATTRIBUTES {
   my ($class,$code,@attrs) = @_;
-  $class->mk_classdata('__attr_cache' => {})
+  $class->mk_classaccessor('__attr_cache' => {})
     unless $class->can('__attr_cache');
   $class->__attr_cache->{$code} = [@attrs];
   return ();
@@ -214,7 +214,7 @@ Then you can use these classes in your application's code:
   my $cd = $millennium_cds_rs->next; # SELECT ... FROM cds JOIN artists ...
   my $cd_artist_name = $cd->artist->name; # Already has the data so no 2nd query
 
-  # new() makes a Result object but doesnt insert it into the DB.
+  # new() makes a Result object but doesn't insert it into the DB.
   # create() is the same as new() then insert().
   my $new_cd = $schema->resultset('CD')->new({ title => 'Spoon' });
   $new_cd->artist($cd->artist);
@@ -291,7 +291,7 @@ accessible at the following locations:
 =item * Travis-CI log: L<https://travis-ci.org/dbsrgits/dbix-class/builds>
 
 =for html
-&#x21AA; Stable branch CI status: <img src="https://secure.travis-ci.org/dbsrgits/dbix-class.png?branch=master"></img>
+&#x21AA; Bleeding edge dev CI status: <img src="https://secure.travis-ci.org/dbsrgits/dbix-class.png?branch=master"></img>
 
 =back