Algorithm::C3 0.05 review
DownloadAlgorithm::C3 is a module for merging hierarchies using the C3 algorithm. SYNOPSIS use Algorithm::C3; # merging a clas
|
|
Algorithm::C3 is a module for merging hierarchies using the C3 algorithm.
SYNOPSIS
use Algorithm::C3;
# merging a classic diamond
# inheritence graph like this:
#
#
# /
#
# /
#
my @merged = Algorithm::C3::merge(
'D',
sub {
# extract the ISA array
# from the package
no strict 'refs';
@{$_[0] . '::ISA'};
}
);
print join ", " => @merged; # prints D, B, C, A
This module implements the C3 algorithm. I have broken this out into it's own module because I found myself copying and pasting it way too often for various needs. Most of the uses I have for C3 revolve around class building and metamodels, but it could also be used for things like dependency resolution as well since it tends to do such a nice job of preserving local precendence orderings.
Requirements:
Perl
Algorithm::C3 0.05 keywords