diff options
-rw-r--r-- | Echolot/Config.pm | 30 | ||||
-rw-r--r-- | Echolot/Storage/File.pm | 28 | ||||
-rw-r--r-- | NEWS | 13 | ||||
-rwxr-xr-x | pingd | 4 | ||||
-rw-r--r-- | pingd.conf | 29 | ||||
-rwxr-xr-x | tools/convert-xml-to-datadumper | 14 |
6 files changed, 64 insertions, 54 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 @@ -0,0 +1,13 @@ +Changes in version 2.0 beta2 - 2002-07-10 + * Moved from XML to Data::Dumper + Use convert-xml-to-datadumper in the tools directory to + convert your setup: + pingd stop + mv pingd.conf pingd.conf.old + mv data/metadata data/metadata.old + convert-xml-to-datadumper CONFIG < pingd.conf.old > pingd.conf + convert-xml-to-datadumper METADATA < data/metadata.old > data/metadata + pingd start + +Changes in version 2.0 beta1 - 2002-07-07 + * Initial public beta test @@ -1,7 +1,7 @@ #!/usr/bin/perl -wT # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: pingd,v 1.21 2002/07/07 01:11:59 weasel Exp $ +# $Id: pingd,v 1.22 2002/07/10 11:49:41 weasel Exp $ # =pod @@ -205,8 +205,6 @@ Please report them at E<lt>URL:http://savannah.gnu.org/bugs/?group=echolotE<gt> =cut use strict; -use XML::Parser; -use XML::Dumper; use Getopt::Long; use English; use Carp; @@ -1,17 +1,14 @@ -<!-- vim:set syn=xml: --> -<!-- $Id: pingd.conf,v 1.13 2002/07/06 23:26:32 weasel Exp $ --> +# vim:set syntax=perl: -<perldata> - <hash> - <item key="homedir">/home/pinger/echolot</item> - <item key="sitename">unconfigured</item> - <item key="my_localpart">pinger</item> - <item key="my_domain">example.com</item> - <item key="Pinger::Mix"> - <hash> - <item key="mixdir">/home/pinger/Mix</item> - <item key="mix">/home/pinger/Mix/mix</item> - </hash> - </item> - </hash> -</perldata> +$CONFIG = { + 'homedir' => '/home/pinger/echolot', + 'sitename' => 'unconfigured', + + 'my_localpart' => 'pinger', + 'my_domain' => 'example.com', + + 'Pinger::Mix' => { + 'mix' => '/home/pinger/Mix/mix', + 'mixdir' => '/home/pinger/Mix' + } + }; diff --git a/tools/convert-xml-to-datadumper b/tools/convert-xml-to-datadumper new file mode 100755 index 0000000..26d8c27 --- /dev/null +++ b/tools/convert-xml-to-datadumper @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w + +use strict; +use XML::Parser; +use XML::Dumper; +use Data::Dumper; + + +my $parser = new XML::Parser(Style => 'Tree'); +my $tree = $parser->parse( join ('', <stdin>) ); +my $dump = new XML::Dumper; +my $CONFIG = $dump->xml2pl($tree); + +print Data::Dumper->Dump([ $CONFIG ], [ $ARGV[0] ]); |