++ed by:
1 non-PAUSE user
Daniel Brosseau
and 1 contributors

# NAME

Dependency::Resolver - Simple Dependency resolving algorithm

# VERSION

version 0.07

based on http://www.electricmonk.nl/log/2008/08/07/dependency-resolving-algorithm/

# SYNOPSIS

build dependencies tree

``````    my \$a  = { name => 'A' , version => 1, deps => [ 'B == 1', 'D']};
my \$a2 = { name => 'A' , version => 2, deps => [ 'B => 2, B < 3', 'D']};
my \$b1 = { name => 'B' , version => 1, deps => [ 'C == 1',  'E'] };
my \$b2 = { name => 'B' , version => 2, deps => [ 'C == 2',  'E'] };
my \$b3 = { name => 'B' , version => 3, deps => [ 'C == 3',  'E'] };
my \$c1 = { name => 'C' , version => 1, deps => [ 'D', 'E'] };
my \$c2 = { name => 'C' , version => 2, deps => [ 'D', 'E'] };
my \$c3 = { name => 'C' , version => 3, deps => [ 'D', 'E'] };
my \$d  = { name => 'D' , version => 1};
my \$e  = { name => 'E' , version => 1};

my \$resolver = Dependency::Resolver->new;

my \$resolved = \$resolver->dep_resolv(\$a);
#  return [ \$d, \$e, \$c1, \$b1, \$a ]

\$resolved = \$resolver->dep_resolv(\$a2);
# return [ \$d, \$e, \$c2, \$b2, \$a2 ]

# method used by dep_resolv (get_module, search_best_dep)
\$resolver->get_modules('B', '==', 1); # return  [\$b1]
\$resolver->get_modules('B', '<=', 2); # return  [\$b1, \$b2]
\$resolver->get_modules('B', '>=', 1); # return  [\$b1, \$b2, \$b3]

\$resolver->search_best_dep('B >= 1');       # return \$b3 (highest version)
\$resolver->search_best_dep('B >= 1, B!=3');       # return \$b2
\$resolver->search_best_dep('B >= 1, B<=3, B!=3'); # return \$b2``````

# SUBROUTINES/METHODS

## dep_resolv(\$node)

returns an arrayref of nodes resolved

# AUTHOR

Daniel Brosseau, `<dab at catapulse.org>`

# BUGS

Please report any bugs or feature requests to `bug-dependency-resolver at rt.cpan.org`, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dependency-Resolver. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

# SUPPORT

You can find documentation for this module with the perldoc command.

``    perldoc Dependency::Resolver``

You can also look for information at:

# ACKNOWLEDGEMENTS

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: