summaryrefslogtreecommitdiff
path: root/Echolot/Config.pm
blob: f679af8c1be94c74d7bd2cc9871c176acd285a39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package Echolot::Config;

# (c) 2002 Peter Palfrader <peter@palfrader.org>
# $Id: Config.pm,v 1.1 2002/06/05 04:05:40 weasel Exp $
#

=pod

=head1 Name

Echolot::Config - echolot configuration

=head1 DESCRIPTION

=cut

use strict;
use warnings;
use XML::Parser;
use XML::Dumper;
use Carp;

my $CONFIG;

sub init() {
	my $DEFAULT;
	$DEFAULT->{'recipient_delimiter'} = '+';
	$DEFAULT->{'dev_random'}          = '/dev/random';
	$DEFAULT->{'hash_len'}            = 8;

	{
		my $parser = new XML::Parser(Style => 'Tree');
		my $tree = $parser->parsefile('pingd.conf');
		my $dump = new XML::Dumper;
		$CONFIG = $dump->xml2pl($tree);
	}
	
	for my $key (keys %$DEFAULT) {
		$CONFIG->{$key} = $DEFAULT->{$key} unless defined $CONFIG->{$key};
	};
};

sub get() {
	return $CONFIG;
};

1;
# vim: set ts=4 shiftwidth=4: