[Bast-commits] r6763 - DBIx-Class/0.08/trunk/lib/DBIx/Class
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Tue Jun 23 08:34:00 GMT 2009
Author: ribasushi
Date: 2009-06-23 08:33:59 +0000 (Tue, 23 Jun 2009)
New Revision: 6763
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
Log:
Real inheritance ordering for load_namespaces
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2009-06-22 23:05:13 UTC (rev 6762)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2009-06-23 08:33:59 UTC (rev 6763)
@@ -7,6 +7,7 @@
use Carp::Clan qw/^DBIx::Class/;
use Scalar::Util qw/weaken/;
use File::Spec;
+use MRO::Compat;
use Sub::Name ();
require Module::Find;
@@ -239,16 +240,29 @@
local *Class::C3::reinitialize = sub { };
use warnings 'redefine';
- # ensure classes are loaded and fetch properly sorted classes
+ # ensure classes are loaded and attached in inheritance order
$class->ensure_class_loaded($_) foreach(values %results);
- my @subclass_last = sort { $results{$a}->isa($results{$b}) } keys(%results);
-
+ my %inh_idx;
+ my @subclass_last = sort {
+
+ ($inh_idx{$a} ||=
+ scalar @{mro::get_linear_isa( $results{$a} )}
+ )
+
+ <=>
+
+ ($inh_idx{$b} ||=
+ scalar @{mro::get_linear_isa( $results{$b} )}
+ )
+
+ } keys(%results);
+
foreach my $result (@subclass_last) {
my $result_class = $results{$result};
my $rs_class = delete $resultsets{$result};
my $rs_set = $class->_ns_get_rsrc_instance ($result_class)->resultset_class;
-
+
if($rs_set && $rs_set ne 'DBIx::Class::ResultSet') {
if($rs_class && $rs_class ne $rs_set) {
carp "We found ResultSet class '$rs_class' for '$result', but it seems "
More information about the Bast-commits
mailing list