/[webpac]/trunk/tools/swishdiff.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/tools/swishdiff.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 621 - (hide annotations)
Sat Jan 1 18:35:23 2005 UTC (19 years, 2 months ago) by dpavlin
File MIME type: text/plain
File size: 1025 byte(s)
small tool to compare to files which are produced for swish-e -S prog

1 dpavlin 621 #!/usr/bin/perl -w
2    
3     use strict;
4     use XML::Simple;
5     use Data::Diff;
6     use Data::Dumper;
7    
8     die "usage: $0 swish-prog-input-1 swish-prog-input-2" if ($#ARGV < 1);
9    
10     my ($file1, $file2) = @ARGV;
11    
12     my ($in1, $in2);
13    
14     open($in1, $file1) || die "$file1: $!";
15     open($in2, $file2) || die "$file2: $!";
16    
17     sub read_record {
18     my $fh = shift || die;
19    
20     my $header = 1;
21    
22     my ($path, $size);
23    
24     while(<$fh>) {
25     chomp;
26     $path = $1 if (/^Path-Name:\s*(.+)$/i);
27     $size = $1 if (/^Content-Length:\s*(.+)$/);
28    
29     if (/^$/) {
30     $header = 0;
31     }
32    
33     next if ($header);
34    
35     print STDERR "$path [$size]\n";
36    
37     my $xml;
38     my $s = read *{$fh}, $xml, $size;
39     warn "read differs from decleared size! $s != $size" if ($s != $size);
40    
41     $xml =~ s/md5=[a-zA-Z0-9]{32}//gs;
42     $xml =~ s/_userid=\d+//gs;
43    
44     return $xml;
45     }
46     }
47    
48     while(! eof($in1) && ! eof($in2)) {
49     my $a = read_record($in1);
50     my $b = read_record($in2);
51    
52     next if ($a eq $b);
53    
54     my $diff = Data::Diff->new( XMLin($a), XMLin($b) );
55    
56     my $raw = $diff->raw;
57    
58     print Dumper($raw->{diff}) if ($raw->{diff});
59     }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26