Difference between revisions of "Esmith::HostsDB"

From SME Server
Jump to navigationJump to search
(Created page with "=== NAME === esmith::HostsDB - interface to esmith hostnames/addresses database in a root terminal you can do perldoc -U esmith::HostsDB === SYNOPSIS === use esmi...")
 
Line 1: Line 1:
 
=== NAME ===
 
=== NAME ===
esmith::HostsDB - interface to esmith hostnames/addresses database
+
esmith::HostsDB - interface to esmith hostnames/addresses database<br />
 +
 
 
in a root terminal you can do  
 
in a root terminal you can do  
 
  perldoc -U esmith::HostsDB
 
  perldoc -U esmith::HostsDB
 +
 
=== SYNOPSIS ===
 
=== SYNOPSIS ===
 
           use esmith::HostsDB;
 
           use esmith::HostsDB;

Revision as of 16:27, 10 December 2013

NAME

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

in a root terminal you can do

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>