Karthik Krishnamurthy > Unix-Conf-Bind8-0.3 > Unix::Conf::Bind8::Conf::Controls

Download:
Unix-Conf-Bind8-0.3.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Unix::Conf::Bind8::Conf::Controls - Class for handling Bind8 configuration directive `controls'

SYNOPSIS ^

        use Unix::Conf::Bind8;

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

        $controls = Unix::Conf::Bind8::Conf->new_controls (
                UNIX    => [ '/var/run/ndc', 0600, 0, 0 ],
                INET    => [ '*', 52, [ qw (any) ], ],
        ) or $controls->die ("couldn't create controls object");

        # or

        $controls = Unix::Conf::Bind8::Conf->get_controls ()
                or $controls->die ("couldn't get controls object");

        # 
        # Operations that can be performed on an Controls object.
        #

        # set the various attributes.

        $ret = $controls->inet ('192.168.1.1', '1000', [ qw (localhost) ])
                or $ret->die ("couldn't set inet channel");

        $ret = $controls->unix ('/etc/namedb/control.pipe', 0600, 0, 0)
                or $ret->die ("couldn't set unix channel");

        # get the attributes

        $ret = $controls->inet () or $ret->die ("couldn't get inet channel");
        printf ("ADDRESS => %s, PORT => %s, ALLOW => %s\n", $ret->[0], $ret->[1],
                "@{$ret->[2]->elements ()});

        $ret = $controls->unix () or $ret->die ("couldn't get unix channel");
        printf ("PATH => %s, PERMS => %d, OWNER => %d, GROUP => %d",
                $ret->[0], $ret->[1], $ret->[2], $ret->[3]);

        # delete
        $ret = $controls->delete_inet () or $ret->die ("couldn't delete inet channel");
        $ret = $controls->delete_unix () or $ret->die ("couldn't delete unix channel");

METHODS ^

new ()
 Arguments
 UNIX   => [ PATH, PERM, OWNER, GROUP ],
 INET   => [ ADDR, PORT, ALLOW ]
 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::Controls object and returns it, on success, an Err object otherwise. Do not use this constructor directly. Use the Unix::Conf::Bind8::Conf::new_controls () method instead.

inet ()
 Arguments
 ADDRESS        # optional
 PORT           # optional
 ALLOW          # optional

Object method. Argument `ALLOW' can either be an Acl object, or an array reference. Get/sets the corresponding attribute, and returns either the attribute values or true on success, an Err object otherwise. The attribute values are returned as an anonymous array [ ADDRESS PORT ALLOW ], where ALLOW is an Acl object.

inet_allow

Object method. Returns the elements defined for the allow as an anonymous array. if defined, an Err object otherwise.

unix ()
 Arguments
 PATH,
 'PERM',        # As string.
 OWNER,
 GROUP

Object method. If arguments are passed, sets it as the value of the corresponding attribute, returns true on success, an Err otherwise. If no arguments are passed, returns the defined value as an anonymous array [ PATH, PERM, OWNER, GROUP ], if defined, an Err object otherwise.

NOTE: The PERM argument is to be specified as a string, to avoid unecessary complications. As this module does not interpret these values, it makes sense to use a string, instead of octal.

delete_inet ()

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

delete_unix ()

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

syntax highlighting: