use Scalar::Util 'blessed';
-our $VERSION = '0.05';
+our $VERSION = '0.06';
# this is our global stash of both
# MRO's and method dispatch tables
# http://www.python.org/2.3/mro.html
sub _merge {
my (@seqs) = @_;
+ my $class_being_merged = $seqs[0]->[0];
my @res;
while (1) {
# remove all empty seqences
my @nonemptyseqs = (map { (@{$_} ? $_ : ()) } @seqs);
# return the list if we have no more no-empty sequences
return @res if not @nonemptyseqs;
+ my $reject;
my $cand; # a canidate ..
foreach my $seq (@nonemptyseqs) {
$cand = $seq->[0]; # get the head of the list
$nothead++ && last if exists $in_tail{$cand};
}
last unless $nothead; # leave the loop with our canidate ...
+ $reject = $cand;
$cand = undef; # otherwise, reject it ...
}
- die "Inconsistent hierarchy" if not $cand;
+ die "Inconsistent hierarchy found while merging '$class_being_merged':\n\t" .
+ "current merge results [\n\t\t" . (join ",\n\t\t" => @res) . "\n\t]\n\t" .
+ "mergeing failed on '$reject'\n" if not $cand;
push @res => $cand;
# now loop through our non-empties and pop
# off the head if it matches our canidate