From: Wolfram Schneider Date: Wed, 28 Apr 2010 15:21:30 +0000 (+0200) Subject: for debug=2 validate records and print a warning in case of problems. X-Git-Tag: CPAN-v1.02~76^2~4 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=e1aa55129d029121d2ac089f4dd9184dd80b081f;p=irspy-moved-to-github.git for debug=2 validate records and print a warning in case of problems. --- 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; }