line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Algorithm::Dependency::Source::HoA; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Algorithm::Dependency::Source::HoA - Source for a HASH of ARRAYs |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# The basic data structure |
12
|
|
|
|
|
|
|
my $deps = { |
13
|
|
|
|
|
|
|
foo => [ 'bar', 'baz' ], |
14
|
|
|
|
|
|
|
bar => [], |
15
|
|
|
|
|
|
|
baz => [ 'bar' ], |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Create the source from it |
19
|
|
|
|
|
|
|
my $Source = Algorithm::Dependency::Source::HoA->new( $deps ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
C implements a |
24
|
|
|
|
|
|
|
L where the items names are provided |
25
|
|
|
|
|
|
|
in the most simple form, a reference to a C of C references. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 METHODS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
This documents the methods differing from the ordinary |
30
|
|
|
|
|
|
|
L methods. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
3
|
|
2625
|
use 5.005; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
326
|
|
35
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
96
|
|
36
|
3
|
|
|
3
|
|
15
|
use Algorithm::Dependency::Source (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
77
|
|
37
|
3
|
|
|
3
|
|
15
|
use Params::Util qw{_HASH _ARRAY0}; |
|
3
|
|
|
|
|
21
|
|
|
3
|
|
|
|
|
195
|
|
38
|
|
|
|
|
|
|
|
39
|
3
|
|
|
3
|
|
16
|
use vars qw{$VERSION @ISA}; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
196
|
|
40
|
|
|
|
|
|
|
BEGIN { |
41
|
3
|
|
|
3
|
|
6
|
$VERSION = '1.110'; |
42
|
3
|
|
|
|
|
728
|
@ISA = 'Algorithm::Dependency::Source'; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
##################################################################### |
50
|
|
|
|
|
|
|
# Constructor |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=pod |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 new $filename |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
When constructing a new C object, an |
57
|
|
|
|
|
|
|
argument should be provided of a reference to a HASH of ARRAY references, |
58
|
|
|
|
|
|
|
containing the names of other HASH elements. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Returns the object, or C if the structure is not correct. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub new { |
65
|
1
|
|
|
1
|
1
|
31
|
my $class = shift; |
66
|
1
|
50
|
|
|
|
9
|
my $hash = _HASH(shift) or return undef; |
67
|
1
|
|
|
|
|
5
|
foreach my $deps ( values %$hash ) { |
68
|
6
|
50
|
|
|
|
20
|
_ARRAY0($deps) or return undef; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# Get the basic source object |
72
|
1
|
50
|
|
|
|
13
|
my $self = $class->SUPER::new() or return undef; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Add our arguments |
75
|
1
|
|
|
|
|
3
|
$self->{hash} = $hash; |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
4
|
$self; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
##################################################################### |
85
|
|
|
|
|
|
|
# Private Methods |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub _load_item_list { |
88
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
# Build the item objects from the data |
91
|
1
|
|
|
|
|
3
|
my $hash = $self->{hash}; |
92
|
6
|
|
|
|
|
25
|
my @items = map { |
93
|
1
|
50
|
|
|
|
5
|
Algorithm::Dependency::Item->new( $_, @{$hash->{$_}} ) |
|
6
|
|
|
|
|
8
|
|
94
|
|
|
|
|
|
|
or return undef; |
95
|
|
|
|
|
|
|
} keys %$hash; |
96
|
|
|
|
|
|
|
|
97
|
1
|
|
|
|
|
5
|
\@items; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=pod |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SUPPORT |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
To file a bug against this module, use the CPAN bug tracking system |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
L |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
For other comments, contact the author. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 AUTHOR |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Adam Kennedy |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 SEE ALSO |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L, L |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 COPYRIGHT |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Copyright 2003 - 2009 Adam Kennedy. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This program is free software; you can redistribute |
125
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
The full text of the license can be found in the |
128
|
|
|
|
|
|
|
LICENSE file included with this module. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |