Anonymous avatar Anonymous committed 0f83531

Converted the $doc global to an accessor.

Comments (0)

Files changed (1)

perl/modules/XML-SemanaticDiff/lib/XML/SemanticDiff.pm

 
 use Encode qw(encode_utf8);
 
-foreach my $accessor (qw(descendents char_accumulator))
+foreach my $accessor (qw(descendents char_accumulator doc))
 {
     no strict 'refs';
     *{__PACKAGE__.'::'.$accessor} = sub {
     };
 }
 
-my $doc = {};
 my $opts = {};
 
 my $xml_context = [];
 
     $test_context = _calc_test_context();
 
-    $doc->{"$test_context"}->{NamespaceURI} = $expat->namespace($element) || "";
-    $doc->{"$test_context"}->{Attributes}   = \%attrs || {};
-    $doc->{"$test_context"}->{TagStart}     = $expat->current_line if $opts->{keeplinenums};
+    $self->doc()->{"$test_context"}->{NamespaceURI} = $expat->namespace($element) || "";
+    $self->doc()->{"$test_context"}->{Attributes}   = \%attrs || {};
+    $self->doc()->{"$test_context"}->{TagStart}     = $expat->current_line if $opts->{keeplinenums};
 
 }
 
 #    warn "text is '$text' \n";
 #    my $ctx = Digest::MD5->new;
 #    $ctx->add("$text");
-#    $doc->{"$test_context"}->{TextChecksum} = $ctx->b64digest;
+#    $self->doc()->{"$test_context"}->{TextChecksum} = $ctx->b64digest;
 
-    $doc->{"$test_context"}->{TextChecksum} = md5_base64(encode_utf8("$text"));
+    $self->doc()->{"$test_context"}->{TextChecksum} = md5_base64(encode_utf8("$text"));
     if ($opts->{keepdata}) {
-        $doc->{"$test_context"}->{CData} = $text;
+        $self->doc()->{"$test_context"}->{CData} = $text;
     }
     
     
         }
     }
     
-    $doc->{"$test_context"}->{TagEnd} = $expat->current_line if $opts->{keeplinenums};
+    $self->doc()->{"$test_context"}->{TagEnd} = $expat->current_line if $opts->{keeplinenums};
 
     pop(@$xml_context);
 }
 sub StartDocument {
     my $self = shift;
     my $expat = shift;
-    $doc = {};
+    $self->doc({});
     $self->descendents({});
     $self->char_accumulator({});
     $opts = $expat->{'Non-Expat-Options'};
 sub EndDocument {
     my $self = shift;
 
-    return $doc;
+    return $self->doc();
 }
 
 
 
     my $slug = '?' . $target . '[' . $PI_position_index->{$target} . ']';
 
-    $doc->{$slug}->{Attributes} = $attrs || {};
-    $doc->{$slug}->{TextChecksum} = "1";
-    $doc->{$slug}->{NamespaceURI} = "";
-    $doc->{$slug}->{TagStart} = $expat->current_line if $opts->{keeplinenums};
-    $doc->{$slug}->{TagEnd} = $expat->current_line if $opts->{keeplinenums};
+    $self->doc()->{$slug}->{Attributes} = $attrs || {};
+    $self->doc()->{$slug}->{TextChecksum} = "1";
+    $self->doc()->{$slug}->{NamespaceURI} = "";
+    $self->doc()->{$slug}->{TagStart} = $expat->current_line if $opts->{keeplinenums};
+    $self->doc()->{$slug}->{TagEnd} = $expat->current_line if $opts->{keeplinenums};
 
 }   
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.