Algorithm-Dependency-Objects

 view release on metacpan or  search on metacpan

lib/Algorithm/Dependency/Objects.pm  view on Meta::CPAN

Algorithm::Dependency::Objects - An implementation of an Object Dependency Algorithm

=head1 SYNOPSIS

	use Algorithm::Dependency::Objects;

	my $o = Algorithm::Dependency::Objects->new(
		objects => \@objects,
		selected => \@selected, # objects which are already taken care of
	);

	my @needed = $o->schedule( $objects[0] );

	# need to take care of @needed for $objecs[0] to be resolved

=head1 DESCRIPTION

This modules is a re-implementation of L<Algorithm::Dependency> using only
objects instead of object ids, making use of L<Set::Object> for book-keeping.

=head1 METHODS

=over 4

=item B<new>

Duh.

=item B<objects>

=item B<selected>

Returns the L<Set::Object> representing this collection. Objects is an
enumeration of all the object who we're dependo-frobnicating, and selected is
those that don't need to be run.

=item B<depends>

=item B<schedule>

=item B<schedule_all>

See L<Algorithm::Dependency>'s corresponding methods.

=item B<verify_input_set> $object_set

Make sure that the dependencies of every object in the set are also in the set.

=item B<handle_missing_objects> $missing_set, $input_set

Called by C<verify_input_set> when objects are missing from the input set.

You can override this method to simply return

	$input_set->union($missing_set);

making all dependencies of the input objects implicit input objects themselves.

=item B<unknown_object> $object

Called when a new object pops out of the blue in the middle of processing (it
means C<get_deps> is returning inconsistent values).

=item B<get_deps> $object

Extract the dependencies out of an object. Calls C<depends> on the object.

=item B<can_get_deps> $object

Default implementation is

	$object->can("depends");

=item B<assert_can_get_deps> $object_set

Croaks if C<can_get_deps> doesn't return true for every object in the set.


=back

=head1 SEE ALSO

Adam Kennedy's excellent L<Algorithm::Dependency> module, upon which this is based.

=head1 BUGS

None that we are aware of. Of course, if you find a bug, let us know, and we will be sure to fix it.

=head1 CODE COVERAGE

We use Devel::Cover to test the code coverage of our tests, below is the Devel::Cover report on this module test suite.

=head1 AUTHORS

Yuval Kogman

Stevan Little

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2005 Yuval Kogman, Stevan Little

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

=cut



( run in 1.263 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )