Subject: | Graphviz should integrate with Algorithm::Dependency |
Graphviz graphs dependencies quite nicely.
Algorithm::Dependency is a base class for modelling and resolving dependency systems. There are an increasing number of different things that use this inside their guts to make dependency resolution happen.
It would be very very handy if an Algorithm::Dependency object (or also the Algorithm::Dependency::Source object directly) could just be thrown at Graphviz directly.
sub add_source {
my $self = shift;
my $Source = UNIVERSAL::isa($_[0], 'Algorithm::Dependency::Source') ? shift : return undef;
foreach my $Item ( $Source->items ) {
$self->add_node( $Item->id );
}
foreach my $from ( $Source->items ) {
foreach my $to ( $from->depends ) {
$self->add_edge( $from => $to );
}
}
return 1;
}
... or something along the same lines.
And the neat part would be that you don't even need to add a module dependency to Alg::Dep. If they have the Alg::Dep objects, they have the module.