This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Damian-o-rama: upgrade to Attribute::Handlers 0.75,
[perl5.git] / lib / NEXT / README
1 ==============================================================================
2                        Release of version 0.02 of NEXT
3 ==============================================================================
4
5
6 NAME
7
8     NEXT - Pseudo class for method redispatch
9
10
11 DESCRIPTION
12
13     NEXT.pm adds a pseudoclass named C<NEXT> to any program that
14     uses it. If a method C<m> calls C<$self->NEXT::m()>, the call to
15     C<m> is redispatched as if the calling method had not originally
16     been found.
17
18     In other words, a call to C<$self->NEXT::m()> resumes the
19     depth-first, left-to-right search of parent classes that
20     resulted in the original call to C<m>.
21
22     Note that this is not the same thing as C<$self->SUPER::m()>, which
23     begins a new dispatch that is restricted to searching the ancestors
24     of the current class. C<$self->NEXT::m()> can backtrack past
25     the current class -- to look for a suitable method in other
26     ancestors of C<$self> -- whereas C<$self->SUPER::m()> cannot.
27
28     An particularly interesting use of redispatch is in
29     C<AUTOLOAD>'ed methods. If such a method determines that it is
30     not able to handle a particular call, it may choose to
31     redispatch that call, in the hope that some other C<AUTOLOAD>
32     (above it, or to its left) might do better.
33
34     Note that it is a fatal error for any method (including C<AUTOLOAD>)
35     to attempt to redispatch any method except itself. For example:
36
37             sub D::oops { $_[0]->NEXT::other_method() } # BANG!
38
39
40 AUTHOR
41
42     Damian Conway (damian@conway.org)
43
44
45 COPYRIGHT
46
47          Copyright (c) 2000-2001, Damian Conway. All Rights Reserved.
48          This module is free software. It may be used, redistributed
49             and/or modified under the same terms as Perl itself.
50
51
52 ==============================================================================
53
54 CHANGES IN VERSION 0.02
55
56
57         - Fixed setting of $AUTOLOAD in NEXT'd AUTOLOADS (thanks Leonid)
58
59         - Changed licence for inclusion in core distribution
60
61
62 ==============================================================================
63
64 AVAILABILITY
65
66 NEXT has been uploaded to the CPAN
67 and is also available from:
68
69         http://www.csse.monash.edu.au/~damian/CPAN/NEXT.tar.gz
70
71 ==============================================================================