1Algorithm::Dependency::USsoeurrcCeo(n3t)ributed Perl DocAulmgeonrtiatthimo:n:Dependency::Source(3)
2
3
4

NAME

6       Algorithm::Dependency::Source - Implements a source of hierarchy items
7

VERSION

9       version 1.111
10

DESCRIPTION

12       The Algorithm::Dependency::Source class provides an abstract parent
13       class for implementing sources for the hierarchy data the algorithm
14       will use. For an example of an implementation of this, see
15       Algorithm::Dependency::Source::File, which is bundled with the main
16       Algorithm::Dependency package.
17

METHODS

19   new @arguments
20       Although you cannot directly use the "new" constructor for
21       "Algorithm::Dependency::Source", it will work the same in all
22       subclasses.
23
24       The constructor takes zero or more subclass specific arguments to
25       define the location of the source of the items, and returns a new
26       object. Although it may check that the arguments you passed are valid,
27       the source will usually NOT actually load the items from the source,
28       instead deferring the loading until you need to use the items.
29
30       Returns a new object on success, or "undef" on error.
31
32   load
33       The "load" method is the public method used to actually load the items
34       from their storage location into the the source object. The method will
35       automatically called, as needed, in most circumstances. You would
36       generally only want to use "load" manually if you think there may be
37       some uncertainty that the source will load correctly, and want to check
38       it will work.
39
40       Returns true if the items are loaded successfully, or "undef" on error.
41
42   item $name
43       The "item" method fetches and returns the item object specified by the
44       name argument.
45
46       Returns an Algorithm::Dependency::Item object on success, or "undef" if
47       the named item does not exist in the source.
48
49   items
50       The "items" method returns, as a list of objects, all of the items
51       contained in the source. The item objects will be returned in the same
52       order as that in the storage location.
53
54       Returns a list of Algorithm::Dependency::Item objects on success, or
55       "undef" on error.
56
57   missing_dependencies
58       By default, we are lenient with missing dependencies if the item is
59       never used. For systems where having a missing dependency can be very
60       bad, the "missing_dependencies" method checks all Items to make sure
61       their dependencies exist.
62
63       If there are any missing dependencies, returns a reference to an array
64       of their ids. If there are no missing dependencies, returns 0. Returns
65       "undef" on error.
66

EXTENDING

68       "Algorithm::Dependency::Source" itself is a fairly thin module, and it
69       is intended that you will probably need to extend it to be able to
70       extract item data from whatever location you have stored them.
71
72       This is usually a fairly simple two step process.
73
74       Overload the "new" method.
75           Assuming your subclass takes some form or argument on creation, you
76           will need to overload the "new" method to accept the arguments,
77           validate them, and store them in the source object.
78
79       Define the method "_load_item_list".
80           Leaving our parent's "load" method to take care of conflict,
81           errors, and whatever, the "_load_item_list" method is used to
82           simply create a list of Algorithm::Dependency::Item objects from
83           wherever you store the item, and return them as a list.
84
85       Having completed these two things, your subclass should be completed.
86       For an example of the code, have a look at the source for the simple
87       subclass Algorithm::Dependency::Source::File.
88

SEE ALSO

90       Algorithm::Dependency, Algorithm::Dependency::Source::File
91

SUPPORT

93       Bugs may be submitted through the RT bug tracker
94       <https://rt.cpan.org/Public/Dist/Display.html?Name=Algorithm-
95       Dependency> (or bug-Algorithm-Dependency@rt.cpan.org <mailto:bug-
96       Algorithm-Dependency@rt.cpan.org>).
97

AUTHOR

99       Adam Kennedy <adamk@cpan.org>
100
102       This software is copyright (c) 2003 by Adam Kennedy.
103
104       This is free software; you can redistribute it and/or modify it under
105       the same terms as the Perl 5 programming language system itself.
106
107
108
109perl v5.28.1                      2018-12-22  Algorithm::Dependency::Source(3)
Impressum