Method::Cumulative - Accumulates the effect of methods in a class hierarchy
This document describes Method::Cumulative version 0.05.
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
Method::Cumulative provides an attribute that makes methods cumulative.
Cumulative methods are methods which accumulate the effect of the methods in a class hierarchy.
CUMULATIVE
Makes methods cumulative.
# derived-first order (like destructors) sub foo :CUMULATIVE{ # ... } # base-first order (like constructors) sub bar :CUMULATIVE(BASE FIRST){ # ... }
Perl 5.8.1 or later, and a C Compiler.
No bugs have been reported.
Please report any bugs or feature requests to the author.
Class::Std.
Sub::Attribute.
Goro Fuji (gfx) <gfuji(at)cpan.org>.
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.
To install Method::Cumulative, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Method::Cumulative
CPAN shell
perl -MCPAN -e shell install Method::Cumulative
For more information on module installation, please visit the detailed CPAN module installation guide.