From: Ian Jackson Date: Wed, 23 Sep 2009 23:09:43 +0000 (+0100) Subject: Dump bogus XML in _commodmap.xml if we can't parse it X-Git-Tag: 4.0~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=commitdiff_plain;h=016f2797ee2dfea8948bbb1247eaa9fc5234a35a Dump bogus XML in _commodmap.xml if we can't parse it --- diff --git a/yarrg/commod-results-processor b/yarrg/commod-results-processor index 99c6924..36804d3 100755 --- a/yarrg/commod-results-processor +++ b/yarrg/commod-results-processor @@ -287,7 +287,16 @@ sub refresh_commodmap() { my $content= $resp->content; # print STDERR "[[[$content]]]\n"; - $xp->parse($content); + my $commodmapxmltmp= '_commodmap.xml'; + if (!eval { + $xp->parse($content); 1; + }) { + open R, ">./$commodmapxmltmp" or die $!; + print R $content or die $!; + close R or die $!; + die "$@ parsing commodmap"; + } + unlink $commodmapxmltmp or $!==&ENOENT or die $!; close $o or die $!; rename "_commodmap.tsv.tmp","_commodmap.tsv" or die $!; }