Letter P

perl-NEXT - Provide a pseudo-class NEXT (et al) that allows method redispatch

Website: http://www.perl.org/
License: GPL+ or Artistic
Description:
NEXT.pm adds a pseudoclass named NEXT to any program that uses it.
If a method m calls $self->NEXT::m(), the call to m is redispatched as if the
calling method had not originally been found.
In other words, a call to $self->NEXT::m() resumes the depth-first, left-to-right
search of $self's class hierarchy that resulted in the original call to m.
Note that this is not the same thing as $self->SUPER::m(), which begins a new
dispatch that is restricted to searching the ancestors of the current class.
$self->NEXT::m() can backtrack past the current class -- to look for a suitable
method in other ancestors of $self -- whereas $self->SUPER::m() cannot.
A typical use would be in the destructors of a class hierarchy, as illustrated
in the synopsis above. Each class in the hierarchy has a DESTROY method that
performs some class-specific action and then redispatches the call up the hierarchy.
As a result, when an object of class D is destroyed, the destructors of all its
parent classes are called (in depth-first, left-to-right order).
Another typical use of redispatch would be in AUTOLOAD'ed methods. If such a method
determined that it was not able to handle a particular call, it might choose to
redispatch that call, in the hope that some other AUTOLOAD (above it, or to its left)
might do better.
By default, if a redispatch attempt fails to find another method elsewhere in the
objects class hierarchy, it quietly gives up and does nothing (but see "Enforcing
redispatch"). This gracious acquiescence is also unlike the (generally annoying)
behaviour of SUPER, which throws an exception if it cannot redispatch.

Packages

perl-NEXT-0.64-3m.mo7.noarch [32 KiB] Changelog by Yohsuke Ooi (2010-08-31):
- (6:5.12.1-3m)
- full rebuild for mo7 release

Listing created by Repoview-0.6.5-1m.mo7