GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Algorithm::Dependency::Source(3) User Contributed Perl Documentation Algorithm::Dependency::Source(3)

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

version 1.112

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

Although you cannot directly use the "new" constructor for "Algorithm::Dependency::Source", it will work the same in all subclasses.

The constructor takes zero or more subclass specific arguments to define the location of the source of the items, and returns a new object. Although it may check that the arguments you passed are valid, the source will usually NOT actually load the items from the source, instead deferring the loading until you need to use the items.

Returns a new object on success, or "undef" on error.

The "load" method is the public method used to actually load the items from their storage location into the the source object. The method will automatically called, as needed, in most circumstances. You would generally only want to use "load" manually if you think there may be some uncertainty that the source will load correctly, and want to check it will work.

Returns true if the items are loaded successfully, or "undef" on error.

The "item" method fetches and returns the item object specified by the name argument.

Returns an Algorithm::Dependency::Item object on success, or "undef" if the named item does not exist in the source.

The "items" method returns, as a list of objects, all of the items contained in the source. The item objects will be returned in the same order as that in the storage location.

Returns a list of Algorithm::Dependency::Item objects on success, or "undef" on error.

By default, we are lenient with missing dependencies if the item is never used. For systems where having a missing dependency can be very bad, the "missing_dependencies" method checks all Items to make sure their dependencies exist.

If there are any missing dependencies, returns a reference to an array of their ids. If there are no missing dependencies, returns 0. Returns "undef" on error.

"Algorithm::Dependency::Source" itself is a fairly thin module, and it is intended that you will probably need to extend it to be able to extract item data from whatever location you have stored them.

This is usually a fairly simple two step process.

Overload the "new" method.
Assuming your subclass takes some form or argument on creation, you will need to overload the "new" method to accept the arguments, validate them, and store them in the source object.
Define the method "_load_item_list".
Leaving our parent's "load" method to take care of conflict, errors, and whatever, the "_load_item_list" method is used to simply create a list of Algorithm::Dependency::Item objects from wherever you store the item, and return them as a list.

Having completed these two things, your subclass should be completed. For an example of the code, have a look at the source for the simple subclass Algorithm::Dependency::Source::File.

Algorithm::Dependency, Algorithm::Dependency::Source::File

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

Adam Kennedy <adamk@cpan.org>

This software is copyright (c) 2003 by Adam Kennedy.

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

2020-04-28 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.