-# Now display diffs between the original and modified records
-my $oldFile = "/tmp/old.txu.$$";
-my $newFile = "/tmp/new.txu.$$";
-open OLD, ">$oldFile";
-print OLD $oldText;
-close OLD;
-open NEW, ">/tmp/new.txu.$$";
-print NEW $newText;
-close NEW;
-system("diff $oldFile $newFile");
-unlink($oldFile);
-unlink($newFile);
+if ($opts{w}) {
+ ZOOM::IRSpy::_rewrite_zeerex_record($conn, $xc->getContextNode(), $id);
+ print "Rewrote record '$id'\n";
+}
+
+if ($opts{n}) {
+ foreach my $key (sort keys %data) {
+ my $ref = $fieldsByKey{$key};
+ my($name, $nlines, $caption, $xpath, @addAfter) = @$ref;
+ print "New $caption ($xpath) = '", $xc->findvalue($xpath), "'\n";
+ }
+}
+
+if ($opts{x}) {
+ print $newText;
+}
+
+if ($opts{d}) {
+ my $oldFile = "/tmp/old.txu.$$";
+ my $newFile = "/tmp/new.txu.$$";
+ open OLD, ">$oldFile";
+ print OLD $oldText;
+ close OLD;
+ open NEW, ">/tmp/new.txu.$$";
+ print NEW $newText;
+ close NEW;
+ system("diff $oldFile $newFile");
+ unlink($oldFile);
+ unlink($newFile);
+}