From ecd052098413f87701ba00e28f88563248a177f6 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 5 Jun 2002 04:05:40 +0000 Subject: Initial Import --- Echolot/Config.pm | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Echolot/Config.pm (limited to 'Echolot/Config.pm') diff --git a/Echolot/Config.pm b/Echolot/Config.pm new file mode 100644 index 0000000..f679af8 --- /dev/null +++ b/Echolot/Config.pm @@ -0,0 +1,48 @@ +package Echolot::Config; + +# (c) 2002 Peter Palfrader +# $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: -- cgit v1.2.3