Anonymous avatar Anonymous committed 7590de2

Converted PI_position_index to an object acccesor.

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 opts xml_context))
+foreach my $accessor (qw(descendents char_accumulator doc
+    opts xml_context PI_position_index))
 {
     no strict 'refs';
     *{__PACKAGE__.'::'.$accessor} = sub {
     };
 }
 
-# The position index for the PI's below - the processing instructions.
-my $PI_position_index = {};
+# PI_position_index is the position index for the PI's below - the processing 
+# instructions.
 
 sub new {
     my $class = shift;
     $self->char_accumulator({});
     $self->opts($expat->{'Non-Expat-Options'});
     $self->xml_context([]);
-    $PI_position_index = {};
+    $self->PI_position_index({});
 }
         
 sub EndDocument {
 sub PI {
     my ($self, $expat, $target, $data) = @_;
     my $attrs = {};
-    $PI_position_index->{$target}++;
+    $self->PI_position_index()->{$target}++;
 
     foreach my $pair (split /\s+/, $data) {
         $attrs->{$1} = $2 if $pair =~ /^(.+?)=["'](.+?)["']$/;
     }
 
-    my $slug = '?' . $target . '[' . $PI_position_index->{$target} . ']';
+    my $slug = '?' . $target . '[' . $self->PI_position_index()->{$target} . ']';
 
     $self->doc()->{$slug}->{Attributes} = $attrs || {};
     $self->doc()->{$slug}->{TextChecksum} = "1";
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.