Commits

Anonymous committed 81f5abd

Converted $opts.

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 doc))
+foreach my $accessor (qw(descendents char_accumulator doc opts))
 {
     no strict 'refs';
     *{__PACKAGE__.'::'.$accessor} = sub {
     };
 }
 
-my $opts = {};
-
 my $xml_context = [];
 
 # The position index for the PI's below - the processing instructions.
 
     $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};
+    $self->doc()->{"$test_context"}->{TagStart}     = $expat->current_line if $self->opts()->{keeplinenums};
 
 }
 
 #    $self->doc()->{"$test_context"}->{TextChecksum} = $ctx->b64digest;
 
     $self->doc()->{"$test_context"}->{TextChecksum} = md5_base64(encode_utf8("$text"));
-    if ($opts->{keepdata}) {
+    if ($self->opts()->{keepdata}) {
         $self->doc()->{"$test_context"}->{CData} = $text;
     }
     
         }
     }
     
-    $self->doc()->{"$test_context"}->{TagEnd} = $expat->current_line if $opts->{keeplinenums};
+    $self->doc()->{"$test_context"}->{TagEnd} = $expat->current_line if $self->opts()->{keeplinenums};
 
     pop(@$xml_context);
 }
     $self->doc({});
     $self->descendents({});
     $self->char_accumulator({});
-    $opts = $expat->{'Non-Expat-Options'};
+    $self->opts($expat->{'Non-Expat-Options'});
     $xml_context = [];
     $PI_position_index = {};
 }
     $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};
+    $self->doc()->{$slug}->{TagStart} = $expat->current_line if $self->opts()->{keeplinenums};
+    $self->doc()->{$slug}->{TagEnd} = $expat->current_line if $self->opts()->{keeplinenums};
 
 }