Superclass method redispatch for mixins
use Class::MixinFactory::NEXT; package My::BaseClass; sub foo { return "Foo Bar" } package My::Logging; sub foo { warn "Calling foo"; (shift)->NEXT('foo', @_) } package My::MixedClass; @ISA = ( 'My::Logging', 'My::BaseClass', 'Class::MixinFactory::NEXT'; ); package main; print My::MixedClass->foo();
Enhanced superclass method dispatch for use inside mixin class methods. Allows mixin classes to redispatch to other classes in the inheritance tree without themselves inheriting from anything.
This package defines one method, named \s-1NEXT\s0.
$callee->NEXT( $method, @args );
Searches the inheritance tree of the callee until it finds the package from which \s-1NEXT\s0 is being called, and then continues searching until the next class which can perform the named method.
Unlike \s-1SUPER\s0, this method will backtrack down the inheritance tree to find implementations later in the search path even if they are on a separate branch.
This class is automatically included by Class::MixinFactory.
This is similar to the functionality provided by \s-1NEXT::ACTUAL\s0, but without using \s-1AUTOLOAD\s0; for a more generalized approach to this issue see \s-1NEXT\s0.
For distribution, installation, support, copyright and license information, see Class::MixinFactory::ReadMe.