LCFG::Inventory - fetch and parse XML inventory
use LCFG::Inventory;
# Fetch and Parse LCFG inventory from server
$inv = new LCFG::Inventory
( URL => "http://blah", # URL
CACHE => "/foo/mycache", # Persistent cache
DEBUG => 1, # Debugging
FORCE => 1, # Force refresh the cache
NOFETCH => 1 # Use cache copy only
);
# Return list of FQDNS in inventory
@hosts = $inv->Hosts();
# Return inventory fields for given FQDN
$hash = $inv->Lookup("foo.bar.com");
# Return hash of meta-information about inventory
$hash = $inv->Meta();
When a new LCFG::Inventory object is created, the XML inventory information is fetched from the specified URL, parsed and cached in a local file. The Hosts() function will return a list of FQDNs for all the hosts in the inventory, and the Lookup() function returns a hash of the inventory fields for a given FQDN.
If an explicit CACHE option is given, the named file will be used to store a persistent cache which will only be refreshed when the remote XML changes. The FORCE option can be used to force the refresh of a persistent cache, and the NOFETCH option can be used to force the use of the local cache without checking the remote copy.
/usr/share/doc/lcfg-inventory-1.1.18/example
Solaris9, Fedora3, Fedora5, Fedora6, Scientific5
Stephen Quinney <squinney@inf.ed.ac.uk>