From ab1d707e9733411b2dbd491ac860ebdc6b03f925 Mon Sep 17 00:00:00 2001 From: Wolfram Schneider Date: Wed, 28 Apr 2010 17:21:30 +0200 Subject: [PATCH] for debug=2 validate records and print a warning in case of problems. --- bin/irspy-rewrite-records.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/irspy-rewrite-records.pl b/bin/irspy-rewrite-records.pl index 3dbd731..4c89286 100755 --- a/bin/irspy-rewrite-records.pl +++ b/bin/irspy-rewrite-records.pl @@ -6,7 +6,7 @@ use lib '../lib'; use Data::Dumper; use Getopt::Long; use ZOOM::IRSpy; -use ZOOM::IRSpy::Utils qw(render_record); +use ZOOM::IRSpy::Utils qw(render_record validate_record); use strict; use warnings; @@ -48,6 +48,15 @@ print STDERR "rewriting ", $rs->size(), " target records" if $debug; foreach my $i ( 1 .. $rs->size() ) { my $xml = render_record( $rs, $i - 1, "zeerex" ); my $rec = $spy->{libxml}->parse_string($xml)->documentElement(); + + if ( $debug >= 2 ) { + my ( $ok, $errors ) = validate_record($rec); + if ( !$ok ) { + my @e = @$errors; + my $id = shift @e; + print "Id: $id => ", join( " / ", @e ), "\n"; + } + } ZOOM::IRSpy::_rewrite_zeerex_record( $spy->{conn}, $rec ); print STDERR "." if $debug; } -- 1.7.10.4