1#!/usr/local/bin/perl -w
2######################################################################
3#
4# DNS/Config/Statement/Options.pm
5#
6# $Id: Options.pm,v 1.3 2003/02/16 10:15:33 awolf Exp $
7# $Revision: 1.3 $
8# $Author: awolf $
9# $Date: 2003/02/16 10:15:33 $
10#
11# Copyright (C)2001-2003 Andy Wolf. All rights reserved.
12#
13# This library is free software; you can redistribute it and/or
14# modify it under the same terms as Perl itself.
15#
16######################################################################
17
18package DNS::Config::Statement::Options;
19
20use strict;
21use vars qw(@ISA);
22
23use DNS::Config::Statement;
24
25@ISA = qw(DNS::Config::Statement);
26
27my $VERSION   = '0.66';
28my $REVISION  = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
29
30sub new {
31	my($pkg) = @_;
32	my $class = ref($pkg) || $pkg;
33
34	my $self = {};
35
36	bless $self, $class;
37
38	return $self;
39}
40
41sub parse_tree {
42	my($self, @array) = @_;
43
44	my $data = shift @array;
45	my @data = @$data;
46
47	foreach my $stmt (@data) {
48		my @stmt = @$stmt;
49
50		my $key = uc shift @stmt;
51
52		if(scalar(@stmt) == 1) {
53			$self->{$key} = shift @stmt;
54			$self->{$key} =~ s/^\"//g;
55			$self->{$key} =~ s/\"$//g;
56		}
57		else {
58			$self->{$key} = \@stmt;
59		}
60	}
61
62	return $self
63}
64
65sub dump {
66	my($self) = @_;
67	my @array;
68
69	my @array2;
70	foreach my $key (keys %$self) {
71		if(($key =~ /FILE/) || ($key =~ /DIRECTORY/)) {
72			push @array2, ([ lc $key, q(") . $self->{$key} . q(")]);
73		}
74		else {
75			push @array2, ([ lc $key, $self->{$key}]);
76		}
77	}
78
79	push @array, ('options', \@array2 );
80
81	my $string = $self->substatement(@array);
82	print $string, "\n";
83
84	return $self;
85}
86
87sub directory {
88	my($self) = @_;
89
90	my $directory;
91	if(exists $self->{'DIRECTORY'}) {
92		$directory = $self->{'DIRECTORY'};
93	}
94
95	return $directory;
96}
97
981;
99
100__END__
101
102=pod
103
104=head1 NAME
105
106DNS::Config::Statement::Options - Options statement
107
108=head1 SYNOPSIS
109
110use DNS::Config::Statement::Options;
111
112my $options = new DNS::Config::Statement::Options();
113
114$options->dump();
115
116
117=head1 ABSTRACT
118
119This class represents an options statement in a domain name
120service daemon (DNS) configuration.
121
122
123=head1 DESCRIPTION
124
125This class represents an options statement. As such it can, for
126example, have information about the file system location of zone
127files.
128
129So far this class is strongly related to the ISCs Bind domain
130name service daemon but it is inteded to get more generic in
131upcoming releases. Your help is welcome.
132
133
134=head1 AUTHOR
135
136Copyright (C)2001-2003 Andy Wolf. All rights reserved.
137
138This library is free software; you can redistribute it and/or
139modify it under the same terms as Perl itself.
140
141Please address bug reports and comments to:
142zonemaster@users.sourceforge.net
143
144
145=head1 SEE ALSO
146
147L<DNS::Config>, L<DNS::Config::Statement>
148
149
150=cut
151