summaryrefslogtreecommitdiff
path: root/Echolot
diff options
context:
space:
mode:
Diffstat (limited to 'Echolot')
-rw-r--r--Echolot/Config.pm30
-rw-r--r--Echolot/Storage/File.pm28
2 files changed, 23 insertions, 35 deletions
diff --git a/Echolot/Config.pm b/Echolot/Config.pm
index ebe2a29..8861873 100644
--- a/Echolot/Config.pm
+++ b/Echolot/Config.pm
@@ -1,7 +1,7 @@
package Echolot::Config;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Config.pm,v 1.17 2002/07/07 01:12:00 weasel Exp $
+# $Id: Config.pm,v 1.18 2002/07/10 11:49:41 weasel Exp $
#
=pod
@@ -39,9 +39,8 @@ The configuration file is searched in those places in that order:
use strict;
use warnings;
-use XML::Parser;
-use XML::Dumper;
use Carp;
+use English;
my $CONFIG;
@@ -138,10 +137,15 @@ sub init($) {
die ("no Configuration file found\n") unless defined $configfile;
{
- my $parser = new XML::Parser(Style => 'Tree');
- my $tree = $parser->parsefile($configfile);
- my $dump = new XML::Dumper;
- $CONFIG = $dump->xml2pl($tree);
+ local $/ = undef;
+ open(CONFIGCODE, $configfile) or
+ carp("Could not open configfile '$configfile': $!");
+ my $config_code = <CONFIGCODE>;
+ close (CONFIGCODE);
+ ($config_code) = $config_code =~ /^(.*)$/s;
+ eval ($config_code);
+ ($EVAL_ERROR) and
+ carp("Evaling config code from '$configfile' returned error: $EVAL_ERROR");
}
for my $key (keys %$DEFAULT) {
@@ -160,17 +164,7 @@ sub get() {
};
sub dump() {
- # FIXME XML::Dumper bug workaround
- # There is a bug in pl2xml that changes data passed (cf. Debian Bug #148969 and #148970
- # at http://bugs.debian.org/148969 and http://bugs.debian.org/148970
- require Data::Dumper;
- my $storedata;
- eval ( Data::Dumper->Dump( [ $CONFIG ], [ 'storedata' ] ));
-
- my $dump = new XML::Dumper;
- my $data = $dump->pl2xml($storedata);
-
- print $data;
+ print Data::Dumper->Dump( [ $CONFIG ], [ 'CONFIG' ] );
};
1;
diff --git a/Echolot/Storage/File.pm b/Echolot/Storage/File.pm
index 021bff6..5de1b6c 100644
--- a/Echolot/Storage/File.pm
+++ b/Echolot/Storage/File.pm
@@ -1,7 +1,7 @@
package Echolot::Storage::File;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: File.pm,v 1.27 2002/07/07 01:12:00 weasel Exp $
+# $Id: File.pm,v 1.28 2002/07/10 11:49:41 weasel Exp $
#
=pod
@@ -20,8 +20,7 @@ This package provides several functions for data storage for echolot.
use strict;
use warnings;
-use XML::Parser;
-use XML::Dumper;
+use Data::Dumper;
use IO::Handle;
use English;
use Carp qw{cluck confess};
@@ -163,11 +162,14 @@ sub metadata_read($) {
seek($self->{'METADATA_FH'}, 0, SEEK_SET) or
cluck("Cannot seek to start of metadata file: $!"),
return 0;
- eval {
- my $parser = new XML::Parser(Style => 'Tree');
- my $tree = $parser->parse( $self->{'METADATA_FH'} );
- my $dump = new XML::Dumper;
- $self->{'METADATA'} = $dump->xml2pl($tree);
+ {
+ local $/ = undef;
+ my $fh = $self->{'METADATA_FH'};
+ my $metadata_code = <$fh>;
+ ($metadata_code) = $metadata_code =~ /^(.*)$/s;
+ my $METADATA;
+ eval ($metadata_code);
+ $self->{'METADATA'} = $METADATA;
};
$EVAL_ERROR and
cluck("Error when reading from metadata file: $EVAL_ERROR"),
@@ -191,15 +193,7 @@ sub metadata_read($) {
sub metadata_write($) {
my ($self) = @_;
- # FIXME XML::Dumper bug workaround
- # There is a bug in pl2xml that changes data passed (cf. Debian Bug #148969 and #148970
- # at http://bugs.debian.org/148969 and http://bugs.debian.org/148970
- require Data::Dumper;
- my $storedata;
- eval ( Data::Dumper->Dump( [ $self->{'METADATA'} ], [ 'storedata' ] ));
-
- my $dump = new XML::Dumper;
- my $data = $dump->pl2xml($storedata);
+ my $data = Data::Dumper->Dump( [ $self->{'METADATA'} ], [ 'METADATA' ] );
my $fh = $self->{'METADATA_FH'};
seek($fh, 0, SEEK_SET) or