Esmith::HostsDB

From SME Server

NAME

esmith::HostsDB - interface to esmith hostnames/addresses database

In a root terminal you can do the command below if you want to display the up-to-date content

perldoc -U esmith::HostsDB

SYNOPSIS

          use esmith::HostsDB;
          my $hosts = esmith::HostsDB->open;

          # everything else works just like esmith::DB::db

          # these methods are added
          my @hosts     = $hosts->hosts;
          my @new_hosts = $hosts->propogate_hosts;

DESCRIPTION

This module provides an abstracted interface to the esmith hosts database. Unless otherwise noted, esmith::HostsDB acts like esmith::DB::db.

Overridden methods

open

Like esmith::DB->open, but if given no $file it will try to open the file in the ESMITH_HOSTS_DB environment variable or hosts.

open_ro()

Like esmith::DB->open_ro, but if given no $file it will try to open the file in the ESMITH_HOSTS_DB environment variable or hosts.

Additional Methods

These methods are added be esmith::HostsDB

hosts
                  my @hosts = $hosts->hosts;

Returns a list of all host records in the database.

propogate_hosts
                  my @new_hosts = $hosts->propogate_hosts($old_name, $new_name);

When the name of your e-smith machine changes, this will change the name of any hosts which also started with $old_name to use the $new_name.

Returns a list of the newly tranlsated host records.

                   $db->get_hosts_by_domain

Given a domain name (as a string), finds any hosts which match it and return them as a list of record objects.

AUTHOR

      SME Server Developers <bugs@e-smith.com>