NAME

Class::Multi - Multiple inheritance support functions.

SYNOPSIS

  • A flexible inheritance traversal function.

  • A calling-class-relative metaphor of can().

  • A calling-class-relative metaphor of SUPER::.

Inheritance Traversal Function

walk( \&testsub, CLASS, @avoid )

Executes the supplied code reference once for each superclass of the supplied derived class, in the same depth-first order that PERL uses internally.

If an @avoid list is supplied, the code reference will not be executed until all classes in that list have been seen.

walk { BLOCK } $derived

Executes the { BLOCK } once each for $derived and its superclasses.

walk { BLOCK } $derived, $derived

Executes the { BLOCK } only for $derived's superclasses.

walk { BLOCK } $derived, __PACKAGE__

Executes the { BLOCK } only for classes that are inherited after the class in which the expression is found.

Multi-Inherited Method Search

other( $this, METHOD )

other checks if the object or class $this has a method called 'METHOD', that occurs -AFTER- the calling class in the inheritance tree.

Usage and semantics are otherwise identical to UNIVERSAL::can

The calling class is inferred via caller().

otherpkg( $this, METHOD )

Identical to other, except the package name is returned instead of the desired method's code reference.

Multi-Inherited Mandatory Method Call

$this->OTHER::mymethod( @myargs );

Syntactic sugar.

Equivalent to &{other( $this, 'mymethod' )}( $this, @myargs );.

Like SUPER::, OTHER:: expects the requested method to exist. If it does not, an exception is thrown.

AUTHORS

Kevin Cody-Little <kcody@cpan.org>