summaryrefslogtreecommitdiff
path: root/Echolot/Config.pm
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-06-05 04:05:40 +0000
committerPeter Palfrader <peter@palfrader.org>2002-06-05 04:05:40 +0000
commitecd052098413f87701ba00e28f88563248a177f6 (patch)
tree0b31ba6942617df44e2745014b291df97625021c /Echolot/Config.pm
Initial Import
Diffstat (limited to 'Echolot/Config.pm')
-rw-r--r--Echolot/Config.pm48
1 files changed, 48 insertions, 0 deletions
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 <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: