From: Scott McWhirter Date: Tue, 13 Feb 2007 09:01:15 +0000 (+0000) Subject: Added a commented out warning that when enabled displays an output very similar X-Git-Tag: 0.07~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fc8171f529c4aa733d6e3aaf6f6b5ce53cdc0c13;p=gitmo%2FAlgorithm-C3.git Added a commented out warning that when enabled displays an output very similar to the formula-esque descriptions on http://www.python.org/download/releases/2.3/mro/ --- diff --git a/lib/Algorithm/C3.pm b/lib/Algorithm/C3.pm index 92ae309..9380629 100644 --- a/lib/Algorithm/C3.pm +++ b/lib/Algorithm/C3.pm @@ -86,6 +86,10 @@ sub merge { if(!$winner) { # looking for a winner $cand = $_->[0]; # seq head is candidate next if $tails{$cand}; # he loses if in %tails + + # Handy warn to give a output like the ones on + # http://www.python.org/download/releases/2.3/mro/ + #warn " = " . join(' + ', @res) . " + merge([" . join('] [', map { join(', ', @$_) } grep { @$_ } @seqs) . "])\n"; push @res => $winner = $cand; } if($_->[0] eq $winner) { @@ -93,6 +97,11 @@ sub merge { $tails{$_->[0]}-- if @$_; # keep %tails sane } } + + # Handy warn to give a output like the ones on + # http://www.python.org/download/releases/2.3/mro/ + #warn " = " . join(' + ', @res) . "\n" if !$cand; + last if !$cand; die q{Inconsistent hierarchy found while merging '} . $current_root . qq{':\n\t}