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

NAME

Unix::Conf::Bind8::Conf::Trustedkeys - Class for handling Bind8 configuration directive `trustedkeys'.

SYNOPSIS

    use Unix::Conf::Bind8;

    my ($conf, $tk, $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 Trustedkeys object.
    #

    $tk = $conf->new_trustedkeys (
        KEYS => [
            [ 'extremix.net', 257 255 3 '"AQP2fHpZ4VMpKo/j"' ],
            [ '.', 257 255 1 '"TjKef0x54VpKod~"' ],
    ) or $tk->die ("couldn't create trustedkeys");

    $tk = $conf->get_trustedkeys ()
        or $tk->die ("couldn't get trustedkeys");

    #
    # Operations that can be performed with a trustedkeys object
    #

    # set trustedkey for `yahoo.com'
    $ret = $tk->key ('yahoo.com', 257, 255, 3, '"aRlOs7dOc/a"')
        or $ret->die ("couldn't set trustedkeys for `yahoo.com'");

    $ret = $tk->key ('extremix.net')
        or $ret->die ("couldn't get trustedkeys for `extremix.net'");

    # traverse all defined keys
    for my $domain ($tk->domains ()) {
        for my $alg ($tk->algorithms ()) {
            $ret = $tk->key ($domain, $alg);
            print ("@$ret\n"); 
        }
    }

        # another way
        my @keys = $tk->trustedkeys ();
        print "@$_\n" for (@keys);

    # delete a specific key. 
        # Note that if 3 is the only algorithm defined for `extremix.net', the
        # domain itself will be deleted from the internal structure. If the domain
        # `extremix.net' is the only one defined, the invocant object itself if
        # deleted.
    $ret = $tk->delete_key ('extremix.net', 3)
        or $ret->die ("couldn't delete key for `extremix.net', 3");

METHODS

new ()
 Arguments
 KEYS   => [ domain flags protocol algorithm key ]
 or
 KEYS   => [ [ domain flags protocol algorithm key ], [..] ]
 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::Trustedkeys object and returns it, on success, an Err object otherwise. Do not use this constructor directly. Use the Unix::Conf::Bind8::Conf::new_trustedkeys () method instead.

key ()
 Arguments
 DOMAIN
 FLAGS
 PROTOCOL
 ALGORITHM
 KEY

 or

 DOMAIN
 ALGORITHM

Object method. In the first form, sets the key for domain `DOMAIN' and protocol `PROTOCOL' and returns true, on success, an Err object otherwise. In the second form, returns (DOMAIN, FLAGS, PROTOCOL, ALGORITHM, KEY) for the passed domain, algorithm, if defined, an Err object otherwise.

add_key ()
 Arguments
 DOMAIN
 FLAGS
 PROTOCOL
 ALGORITHM
 KEY

Object method. Adds KEY for domain `DOMAIN' and algorithm `ALGORITHM' and returns true, on success, an Err object otherwise.

delete_key ()
 Arguments
 DOMAIN
 ALGORITHM      # optional

Object method. Deletes the KEY for domain `DOMAIN', algorithm `ALGORITHM'. If ALGORITHM is not passed deletes all key for domain `DOMAIN', if defined. If all domains defined are deleted, the object itself is deleted Returns true, an Err object otherwise.

trustedkeys ()

Object method. Returns defined keys. When called in list context, returns all defined directives. Iterates over defined keys, when called in scalar context. Returns `undef' at the end of one iteration, and starts over if called again.

domains ()

Object method. Iterates through all defined domains. Returns them one at a time in scalar context, or all of them in list context.

algorithms ()
 Arguments
 DOMAIN

Object method. Iterates through all defined algorithms defined for domain `DOMAIN'. Returns them one at a time in scalar context, or all of them in list context.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 187:

=over without closing =back