package Algorithm::Dependency::Source::HoA; =pod =head1 NAME Algorithm::Dependency::Source::HoA - Source for a HASH of ARRAYs =head1 SYNOPSIS # The basic data structure my $deps = { foo => [ 'bar', 'baz' ], bar => [], baz => [ 'bar' ], }; # Create the source from it my $Source = Algorithm::Dependency::Source::HoA->new( $deps ); =head1 DESCRIPTION C implements a L where the items names are provided in the most simple form, a reference to a C of C references. =head1 METHODS This documents the methods differing from the ordinary L methods. =cut use strict; use base 'Algorithm::Dependency::Source'; use Params::Util qw{_HASH _ARRAY0}; use vars qw{$VERSION}; BEGIN { $VERSION = '1.104'; } ##################################################################### # Constructor =pod =head2 new $filename When constructing a new C object, an argument should be provided of a reference to a HASH of ARRAY references, containing the names of other HASH elements. Returns the object, or C if the structure is not correct. =cut sub new { my $class = shift; my $hash = _HASH(shift) or return undef; foreach my $deps ( values %$hash ) { _ARRAY0($deps) or return undef; } # Get the basic source object my $self = $class->SUPER::new() or return undef; # Add our arguments $self->{hash} = $hash; $self; } ##################################################################### # Private Methods sub _load_item_list { my $self = shift; # Build the item objects from the data my $hash = $self->{hash}; my @items = map { Algorithm::Dependency::Item->new( $_, @{$hash->{$_}} ) or return undef; } keys %$hash; \@items; } 1; =pod =head1 SUPPORT To file a bug against this module, use the CPAN bug tracking system L For other comments, contact the author. =head1 AUTHOR Adam Kennedy, L, cpan@ali.as =head1 SEE ALSO L, L =head1 COPYRIGHT Copyright (c) 2003 - 2005 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =cut