File Coverage

blib/lib/Unix/Conf/Bind8.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             # Bind8 front.
2             #
3             # Copyright Karthik Krishnamurthy
4              
5             =head1 NAME
6              
7             Unix::Conf::Bind8 - Front end for a suite of classes for manipulating a
8             Bind8 conf and associated zone record files.
9              
10             =head1 SYNOPSIS
11              
12             use Unix::Conf::Bind8;
13             my ($conf, $ret);
14              
15             # get a new Bind8::Conf object. If one exists with the same
16             # name it is parsed.
17             $conf = Unix::Conf::Bind8->new_conf (
18             FILE => 'named.conf',
19             SECURE_OPEN => 1
20             ) or $conf->die ('could not open \'named.conf\'');
21              
22             $db = Unix::Conf::Bind8->new_db (
23             FILE => '/etc/namedb/db.extremix.net',
24             ORIGIN => 'extremix.net',
25             CLASS => 'IN',
26             SECURE_OPEN => 0,
27             ) or $db->die ("couldn't create db");
28              
29             =head1 METHODS
30              
31             =cut
32              
33             package Unix::Conf::Bind8;
34              
35 10     10   217205 use 5.6.0;
  10         34  
  10         441  
36 10     10   87 use strict;
  10         17  
  10         312  
37 10     10   46 use warnings;
  10         24  
  10         255  
38              
39 10     10   7204 use Unix::Conf::Bind8::Conf;
  0            
  0            
40             use Unix::Conf::Bind8::DB;
41              
42             $Unix::Conf::Bind8::VERSION = "0.3";
43              
44             =over 4
45              
46             =item new_conf ()
47              
48             Arguments
49             FILE => PATHNAME,
50             SECURE_OPEN => 1/0, # default 1 (enabled)
51              
52             Class Method
53             Read Bind8 configuration file PATHNAME or create one if none
54             exists.
55             Returns a Bind8::Conf object in case of success or an Err object
56             in case of failure. Refer to docs for Bind8::Conf for further
57             information.
58              
59             =cut
60              
61             sub new_conf ()
62             {
63             shift ();
64             return (Unix::Conf::Bind8::Conf->new (@_));
65             }
66              
67             =item new_db ()
68              
69             Arguments
70             FILE => PATHNAME, # pathname of the records file
71             ORIGIN => ZONE_ORIGIN, # from the zone statement
72             CLASS => ZONE_CLASS, # from the zone statement
73             SECURE_OPEN => 1/0, # default 1 (enabled)
74              
75             Class method.
76             Read a zone records file PATHNAME or create one if none exists.
77             Returns a Bind8::DB object in case of success or an Err object in
78             case of failure. Do not use this method. Use
79             Unix::Conf::Bind8::Conf::Zone::get_db (), or better still,
80             Unix::Conf::Bind8::Conf::get_db () instead.
81             Refer to docs for Bind8::DB for further information.
82              
83             =cut
84            
85             sub new_db ()
86             {
87             shift ();
88             return (Unix::Conf::Bind8::DB->new (@_));
89             }
90              
91             1;
92             __END__