Name : perl-NEXT
| |
Version : 0.69
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp154.1.1
| Date : 2023-01-27 16:50:33
|
Group : Unspecified
| Source RPM : perl-NEXT-0.69-lp154.1.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : Provide a pseudo-class NEXT (et al) that allows method redispatch
|
Description :
The \'NEXT\' module 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.
*Note:* before using this module, you should look at at https://metacpan.org/pod/mro#next::method in the core mro module. \'mro\' has been a core module since Perl 5.9.5.
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 S 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.
Note that it is a fatal error for any method (including \'AUTOLOAD\') to attempt to redispatch any method that does not have the same name. For example:
sub S::oops { print \"oops!\ \"; $_[0]->NEXT::other_method() }
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-N/15.4/noarch |