The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Unix::Conf::Bind8::Conf::Zone - Class for representing the Bind8 zone directive

SYNOPSIS

    use Unix::Conf::Bind8;

    my ($conf, $zone, $acl, $db, $ret);
    $conf = Unix::Conf::Bind8->new_conf (
        FILE        => '/etc/named.conf',
        SECURE_OPEN => 1,
    ) or $conf->die ("couldn't open `named.conf'");

    #
    # Ways to get a Zone object.
    #
        
    $zone = $conf->new_zone (
        NAME    => 'extremix.net',
        TYPE    => 'master',
        FILE    => 'db.extremix.net',
    ) or $zone->die ("couldn't create zone");

    # OR

    $zone = $conf->get_zone ('extremix.net')
        or $zone->die ("couldn't get zone");
                
        #
        # Operations that can be performed on a Zone object.
        #

    $ret = $zone->type ('slave') $ret->die ("couldn't change type");
    $ret = $zone->masters (qw (192.168.1.1 192.168.1.2))
        or $ret->die ("couldn't set masters");

    # create a new acl to be defined before the zone directive
    # 'extremix.net'.
    $acl = $conf->new_acl (
        NAME     => 'extremix.com-slaves', 
        ELEMENTS => [ qw (element1 element2) ],
        WHERE    => 'BEFORE',
        WARG     => $zone,
    ) or $acl->die ("couldn't create `extremix.com-slaves'");

    $ret = $zone->allow_transfer ('extremix.com-slaves')
        or $ret->die ("couldn't set `allow-transfer'");
        
    $ret = $zone->delete_allow_update ()
        or $ret->die ("couldn't delete `allow-update'");

    $db = $zone->get_db () or $db->die ("couldn't get db");
    # Refer to documentation for Unix::Conf::Bind8::DB
    # for manipulating the DB file.

    # delete 
        $ret = $zone->delete () or $ret->die ("couldn't delete");

    # OR

        $ret = $conf->delete_zone ('extremix.net')
                or $ret->die ("couldn't delete zone `extremix.net'");

METHODS

new ()
 Arguments
 NAME             => 'name',
 TYPE             => 'type',            # 'master'|'slave'|'forward'|'stub'|'hint'
 CLASS            => 'class',           # 'in'|'hs'|'hesiod'|'chaos'
 FILE             => 'pathname',
 MASTERS          => {                                  # only if TYPE =~  /'slave'|'stub'/
                                                PORT => 'port'  # optional
                                                ADDRESS => [ qw (ip1 ip2) ],
                                         },     
 FORWARD          => 'yes_no',
 FORWARDERS       => [ qw (ip1 ip2) ],
 CHECK-NAMES      => 'value',           # 'warn'|'fail'|'ignore'
 ALLOW-UPDATE     => [ qw (host1 host2) ],
 ALLOW-QUERY      => [ qw (host1 host2) ],
 ALLOW-TRANSFER   => [ qw (host1 host2) ],
 DIALUP           => 'yes_no',
 NOTIFY           => 'yes_no',
 ALSO-NOTIFY      => [ qw (ip1 ip2) ],
 WHERE  => 'FIRST'|'LAST'|'BEFORE'|'AFTER'
 WARG   => Unix::Conf::Bind8::Conf::Directive subclass object
                        # WARG is to be provided only in case WHERE eq 'BEFORE 
                        # or WHERE eq 'AFTER'
 PARENT => reference,   # to the Conf object datastructure.

Class constructor Creates a new Unix::Conf::Bind8::Conf::Zone object and returns it if successful, an Err object otherwise. Do not use this constructor directly. Use Unix::Conf::Bind8::Conf::new_zone () instead.

name ()
 Arguments
 'zone',    # optional

Object method. Get/Set object's name attribute. If argument is passed, the method tries to set the name attribute to 'zone', and returns true if successful, an Err object otherwise. If no argument is passed, returns the name of the zone, if defined, an Err object otherwise.

class ()
 Arguments
 'class',     # optional

Object method. Get/Set object's class attribute. If argument is passed, the method tries to set the class attribute to 'class', and returns true if successful, an Err object otherwise. If no argument is passed, returns the class of the zone, if defined, an Err object otherwise.

file ()
 Arguments
 'file',    # optional

Object method. Get/Set the object's file attribute. If argument is passed, the method tries to set the file attribute to 'file', and returns true if successful, and Err object otherwise. If no argument is passed, returns the file of the zone, if defined, an Err object otherwise.

type ()
 Arguments
 'type',    # optional

Object method. Get/Set the object's type attribute. If argument is passed, the method tries to set the type attribute to 'type', and returns true if successful, an Err object otherwise. If no argument is passed, returns the type of the zone, if defined, an Err object otherwise.

forward ()
notify ()
dialup ()
 Arguments
 SCALAR,                # 'yes'|'no'|0|1

Object method Get/set corresponding attribute in the invocant. If argument is passed, the method tries to set it as the value and returns true if successful, an Err object otherwise. If no argument is passed the value of that attribute is returned if defined, an Err object otherwise.

check_names ()
 Arguments
 string,                # 'warn'|'fail'|'ignore'

Object method Get/set corresponding attribute in the invocant. If argument is passed, the method tries to set it as the value and returns true if successful, an Err object otherwise. If no argument is passed the value of that attribute is returned if defined, an Err object otherwise.

transfer_source ()
 Arguments
 string,                # IPv4 address in dotted quad notation

Object method Get/set corresponding attribute in the invocant. If argument is passed, the method tries to set it as the value and returns true if successful, an Err object otherwise. If no argument is passed the value of that attribute is returned if defined, an Err object otherwise.

max_transfer_time_in ()
 Arguments
 number,                

Object method Get/set corresponding attribute in the invocant. If argument is passed, the method tries to set it as the value and returns true if successful, an Err object otherwise. If no argument is passed the value of that attribute is returned if defined, an Err object otherwise.

also_notify ()
forwarders ()
 Arguments
 LIST                   # List of IPv4 addresses in 
 or                     # dotted quad notation
 [ LIST ]

Object method. Get/set the corresponding attribute in the invoking object. If argument(s) is/are passed, the method tries to set the attribute and returns true on success, an Err object otherwise. If no arguments are passed then the method tries to return an array reference if the attribute is defined, an Err object otherwise.

add_to_also_notify ()
add_to_forwarders ()
add_to_masters ()
 Arguments
 LIST                   # List of IPv4 addresses in
 or                             # dotted quad notation.
 [ LIST ]

Object method. Add the elements of the list to the corresponding attribute. Return true on success, an Err object otherwise.

delete_from_also_notify ()
delete_from_forwarders ()
delete_from_masters ()
 Arguments
 LIST                   # List of IPv4 addresses in
 or                             # dotted quad notation.
 [ LIST ]

Object method. Delete elements of the list from the corresponding attribute. Return true on success, an Err object otherwise.

allow_transfer ()
allow_query ()
allow_update ()
 Arguments
 Acl object,
 or
 LIST
 or 
 [ LIST ]

Object method. If argument(s) is/are passed, tries to set the elements of the corresponding attribute and returns true on success, an Err object otherwise. If no arguments are passed, tries to return the elements defined for that attribute as an anonymous array, if defined, an Err object otherwise.

add_to_allow_transfer ()
add_to_allow_query ()
add_to_allow_update ()
delete_from_allow_transfer ()
delete_from_allow_query ()
delete_from_allow_update ()
 Arguments
 LIST
 [ LIST ]

Object method. Add to/delete from elements defined for the corresponding attributes. Returns true on success, an Err object otherwise.

delete_forward ()
delete_notify ()
delete_dialup ()
delete_check_names ()
delete_transfer_source ()
delete_max_transfer_time_in ()
delete_also_notify ()
delete_forwarders ()
delete_allow_transfer ()
delete_allow_query ()
delete_allow_update ()
delete_file ()
delete_class ()
delete_type ()
delete_masters ()
delete_also_notify ()
delete_forwarders ()
delete_pubkey ()

Object method. Deletes the corresponding attribute, if defined and returns true, an Err object otherwise.

masters ()
 Arguments
 PORT           => port,        # optional
 ADDRESS        => [ LIST ],

Object method. Get/sets the 'masters' attribute. If argument is passed, the attribute is set to the argument and returns true on success, an Err object otherwise. If not the attribute value is returned in the form of an anonymous array ([ PORT, [ LIST OF ADDRESSES ] ]), if defined, an Err object otherwise.

masters_port ()
 Arguments
 'port',     # optional

Object method. Get/Set the object's masters port attribute. If argument is passed, the method tries to set the masters port attribute to 'port', and returns true if successful, an Err object otherwise. If no argument is passed, returns the masters port, if defined, an Err object otherwise.

pubkey ()
 Arguments
 LIST                   # flags, protocol, algorithm, string
 or 
 [ LIST ]               # same structure
delete_directive ()
 Arguments
 'directive',

Object method. Deletes the directive passed as argument, if defined, and returns true, an Err object otherwise.

get_db ()
 Arguments,
 number,    # 0/1 secure open

Constructor This method is a wrapper method of the class constructor of the Unix::Conf::Bind8::DB class. Creates and returns a new Unix::Conf::Bind8::DB object representing the records file for the zone, if successful, an error object otherwise.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 212:

=over without closing =back