From: Mike Taylor Date: Wed, 2 May 2007 13:52:54 +0000 (+0000) Subject: modify_xml_document()'s code for no-opping when no change has been X-Git-Tag: CPAN-v1.02~54^2~389 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=801f1db41faee3a60541a94b99a06cba228c4337;p=irspy-moved-to-github.git modify_xml_document()'s code for no-opping when no change has been made now also works for present-but-empty fields. --- diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index 09f6b8f..6049e93 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -1,4 +1,4 @@ -# $Id: Utils.pm,v 1.29 2007-05-01 15:29:36 mike Exp $ +# $Id: Utils.pm,v 1.30 2007-05-02 13:52:54 mike Exp $ package ZOOM::IRSpy::Utils; @@ -232,21 +232,21 @@ sub modify_xml_document { # we'll check whether the element is already # canonical, to determine whether our change is a # no-op. - my $old = "???"; + my $old = ""; my @children = $node->childNodes(); if (@children == 1) { my $child = $node->firstChild(); if (ref $child && ref $child eq "XML::LibXML::Text") { $old = $child->getData(); - next if $value eq $old; } } + next if $value eq $old; $node->removeChildNodes(); my $child = new XML::LibXML::Text($value); $node->appendChild($child); push @changes, $ref; - #print "Elem $key: '$old' -> '$value' ($xpath)
\n"; + print STDERR "Elem $key: '$old' -> '$value' ($xpath)
\n"; } else { warn "unexpected node type $node"; }