From: Casey West Date: Tue, 29 Jul 2003 17:37:15 +0000 (-0400) Subject: NEXT and Diamond Inheritance X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d36e5bffcaa31e87b66f7867bd33e8c225204efd;p=p5sagit%2Fp5-mst-13.2.git NEXT and Diamond Inheritance Message-ID: <20030729213715.GY76899@geeknest.com> (Use Damian's NEXT-0.51 once Damian and PAUSE like each other) p4raw-id: //depot/perl@20348 --- diff --git a/lib/NEXT.pm b/lib/NEXT.pm index 68b3df2..3d90696 100644 --- a/lib/NEXT.pm +++ b/lib/NEXT.pm @@ -1,5 +1,5 @@ package NEXT; -$VERSION = '0.50'; +$VERSION = '0.51'; use Carp; use strict; @@ -43,6 +43,7 @@ sub AUTOLOAD @{$NEXT::NEXT{$self,$wanted_method}} = map { (*{"${_}::AUTOLOAD"}{CODE}) ? "${_}::AUTOLOAD" : ()} @forebears unless @{$NEXT::NEXT{$self,$wanted_method}||[]}; + $NEXT::SEEN->{$self,*{$caller}{CODE}}++; } my $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; while ($wanted_class =~ /^NEXT:.*:UNSEEN/ && defined $call_method diff --git a/lib/NEXT/t/unseen.t b/lib/NEXT/t/unseen.t index af8d1f7..ec24564 100644 --- a/lib/NEXT/t/unseen.t +++ b/lib/NEXT/t/unseen.t @@ -5,7 +5,7 @@ BEGIN { } } -BEGIN { print "1..4\n"; } +BEGIN { print "1..5\n"; } use NEXT; my $count=1; @@ -34,3 +34,14 @@ my $foo = {}; bless($foo,"A"); $foo->test; + +package Diamond::Base; +sub test { print "ok ", $count++, "\n"; shift->NEXT::UNSEEN::test; } + +package Diamond::Left; @ISA = qw[Diamond::Base]; +package Diamond::Right; @ISA = qw[Diamond::Base]; +package Diamond::Top; @ISA = qw[Diamond::Left Diamond::Right]; + +package main; + +Diamond::Top->test;