The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Method::Cumulative - Accumulates the effect of methods in a class hierarchy

VERSION

This document describes Method::Cumulative version 0.05.

SYNOPSIS

        package A;
        use parent qw(Method::Cumulative);
        sub foo{
                print "A";
        }
        sub bar{
                print "A";
        }

        package B;
        use parent -norequire => qw(A);
        sub foo :CUMULATIVE{
                print "B";
        }
        sub bar :CUMULATIVE(BASE FIRST){
                print "B";
        }

        package C;
        use parent -norequire => qw(A);
        sub foo :CUMULATIVE{
                print "C";
        }
        sub bar :CUMULATIVE(BASE FIRST){
                print "C";
        }

        package D;
        use parent -norequire => qw(C B);
        use mro 'c3';
        sub foo :CUMULATIVE{
                print "D";
        }
        sub bar :CUMULATIVE(BASE FIRST){
                print "D";
        }

        D->foo(); # => DCBA
        D->bar(); # => ABCD

DESCRIPTION

Method::Cumulative provides an attribute that makes methods cumulative.

Cumulative methods are methods which accumulate the effect of the methods in a class hierarchy.

INTERFACE

The CUMULATIVE subroutine attribute

Makes methods cumulative.

        # derived-first order (like destructors)
        sub foo :CUMULATIVE{
                # ...
        }

        # base-first order (like constructors)
        sub bar :CUMULATIVE(BASE FIRST){
                # ...
        }

DEPENDENCIES

Perl 5.8.1 or later, and a C Compiler.

BUGS

No bugs have been reported.

Please report any bugs or feature requests to the author.

SEE ALSO

Class::Std.

Sub::Attribute.

AUTHOR

Goro Fuji (gfx) <gfuji(at)cpan.org>.

LICENSE AND COPYRIGHT

Copyright (c) 2009, Goro Fuji (gfx). Some rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.