From: Stevan Little Date: Tue, 15 Nov 2005 21:40:51 +0000 (+0000) Subject: version with the better diagnostics X-Git-Tag: 0_07~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FClass-C3.git;a=commitdiff_plain;h=4e47d2a4aadec10a1b894cbae0bfc607757c4dfe version with the better diagnostics --- diff --git a/ChangeLog b/ChangeLog index 03b0434..fc38de9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ Revision history for Perl extension Class::C3. +0.06 - + - added Sub::Name to dependencies (even though it is + just for the tests) + - removed OS X resource fork which slipped into the tar.gz + - improved error reporting for Inconsistent Hierarchies + 0.05 - Mon, Nov 14, 2005 - added caching to next::method, courtesy of quicksilver and mst over at #dbi-class diff --git a/Makefile.PL b/Makefile.PL index f62e12e..8df0ff9 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,12 +1,11 @@ use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Class::C3', 'VERSION_FROM' => 'lib/Class/C3.pm', # finds $VERSION 'PREREQ_PM' => { 'Test::More' => 0.47, 'Test::Exception' => 0.15, - 'Scalar::Util' => 1.10 + 'Scalar::Util' => 1.10, + 'Sub::Name' => 0 } ); diff --git a/README b/README index 4941635..bb4f26e 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Class::C3 version 0.05 +Class::C3 version 0.06 =========================== INSTALLATION diff --git a/lib/Class/C3.pm b/lib/Class/C3.pm index 1b4ea74..ae2635b 100644 --- a/lib/Class/C3.pm +++ b/lib/Class/C3.pm @@ -6,7 +6,7 @@ use warnings; 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 @@ -139,12 +139,14 @@ sub _remove_method_dispatch_table { # 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 @@ -159,9 +161,12 @@ sub _merge { $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 diff --git a/t/10_Inconsistent_hierarchy.t b/t/10_Inconsistent_hierarchy.t index b558146..85ba0c6 100644 --- a/t/10_Inconsistent_hierarchy.t +++ b/t/10_Inconsistent_hierarchy.t @@ -51,4 +51,5 @@ eval { # and watch it explode :) Class::C3::calculateMRO('Z') }; +#diag $@; like($@, qr/^Inconsistent hierarchy/, '... got the right error with an inconsistent hierarchy'); diff --git a/t/32_next_method_edge_cases.t b/t/32_next_method_edge_cases.t index 4f85e74..0e5e913 100644 --- a/t/32_next_method_edge_cases.t +++ b/t/32_next_method_edge_cases.t @@ -9,6 +9,8 @@ BEGIN { use_ok('Class::C3'); } +use Sub::Name; + { { @@ -38,8 +40,6 @@ BEGIN { our @ISA = ('Foo'); } - use Sub::Name; - my $m = sub { (shift)->next::method() }; subname('Bar::bar', $m); {