Unix::Conf::Bind8::Conf::Key - Class for handling Bind8 configuration


Unix-Conf-Bind8 documentation  | view source Contained in the Unix-Conf-Bind8 distribution.

Index


NAME

Top

Unix::Conf::Bind8::Conf::Key - Class for handling Bind8 configuration directive `key'

SYNOPSIS

Top

	use Unix::Conf::Bind8;

	my ($conf, $key, $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 key object
	#

	$key = $conf->new_key (
		NAME		=> 'sample_key',
		ALGORITHM	=> 'hmac-md5',
		SECRET		=> '"abcdefgh"',
	) or $key->die ("couldn't create key");

	# OR

	$key = $conf->get_key ('extremix-slaves.key')
		or $key->die ("couldn't get key");

	#
	# Operations that can be performed on a Key object
	#

	$ret = $key->name ('some_other_key')
		or $ret->die ("couldn't set name");

	$ret = $key->secret ('"secret"')
		or $ret->die ("couldn't set secret");

	# get attributes
	printf ("KEY ID => %s, ALGORITHM => %s, SECRET => %s",
		$key->name (), $key->algorithm (), $key->secret ());

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

	$ret = $conf->delete_key ('sample_key')
		or $ret->die ("couldn't delete");

METHODS

Top

new ()
 Arguments
 NAME		=> scalar,
 ALGORITHM	=> scalar,  # number
 SECRET		=> scalar,  # quoted string
 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::Key object and returns it, on success, an Err object otherwise. Do not use this constructor directly. Use the Unix::Conf::Bind8::Conf::new_key () method instead.

name
 Arguments
 value

Object method. Get/set the corresponding attribute. Returns the attribute value or true on success, an Err object otherwise.

algorithm
 Arguments
 value

Object method. Get/set the corresponding attribute. Returns the attribute value or true on success, an Err object otherwise.

secret
 Arguments
 value

Object method. Get/set the corresponding attribute. Returns the attribute value or true on success, an Err object otherwise.


Unix-Conf-Bind8 documentation  | view source Contained in the Unix-Conf-Bind8 distribution.